Part Number Hot Search : 
Z5250 36C803NQ 4C256 3F064 PIC16F8 4R7M4 ENA1832 CZRT5251
Product Description
Full Text Search
 

To Download MC68HC705MC4 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  hc705mc4grs/d rev 1.5 68hc705mc4 specification (general release) ? january 17, 1995 csic system design group austin, texas the MC68HC705MC4 is an mcu device in a 28-pin dip or soic package with the hc05 cpu core, a 16-bit timer including an output compare and two input captures, an 8-bit a/d converter with a 6 channel input multiplexer, a dual channel pulse width modulator (pwm), an sci and a cop watchdog timer. the 4 k byte memory map has 3584 bytes of user rom/eprom and 176 bytes of ram. motorola reserves the right to make changes without further notice to any products herein to improve reliability, function or design. motorola does not assume any liability arising out of the application or use of any product or circuit described herein; neither does it convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part.
MC68HC705MC4 specification rev. 1.5 motorola page iii table of contents section 1 introduction.............................................................. 1 1.1 features (all timing based on 3 mhz bus) ............................ 1 1.2 mask options........................................................................ 3 1.3 functional pin description............................................ 3 1.3.1 v dd and v ss ......................................................................... 3 1.3.2 osc1, osc2 ........................................................................ 3 1.3.2.1 crystal with internal components ................................... 4 1.3.2.2 ceramic resonator ......................................................... 4 1.3.2.3 external clock ................................................................. 5 1.3.3 reset.................................................................................. 5 1.3.4 pa0, pa1/pwma1, pa2/pwmb1, pa3/pwma2, pa4/pwmb2, pa5/pwma3, pa6/pwmb3, pa7 .................. 5 1.3.5 pb4/tdo, pb5/rdi, pb6, pb7............................................. 5 1.3.6 pc0:5/ad0:5, pc6/vrefh, pc7/vrefl..................................... 5 1.3.7 pd6/tcap1/tcmp, pd7/tcap2 ......................................... 5 1.3.8 irq (maskable interrupt request) / v pp ................ 5 1.4 cpu core ................................................................................ 6 section 2 operating modes...................................................... 7 2.1 user mode ............................................................................. 7 2.2 bootloader mode .............................................................. 8 2.2.1 bootloader functions............................................................ 8 2.2.2 eprom programming register .............................. 11 2.2.2.1 latch - eprom latch control.................................... 12 2.2.2.2 epgm - eprom program control ................................ 12 2.2.3 mask option register (mor) $0f00 ........................ 12 2.2.3.1 cop - cop enable/disable ........................................... 12 2.3 self-check .......................................................................... 13 2.4 low-power modes ............................................................ 13 2.4.1 stop instruction ........................................................ 13 2.4.1.1 stop mode ..................................................................... 13 2.4.2 wait instruction ......................................................... 14 2.5 cop watchdog timer considerations ..................... 15 section 3 resets ......................................................................... 17 3.1 external reset (reset).................................................. 17 3.2 internal resets ................................................................ 17 3.2.1 illegal address reset.............................................. 17 3.2.2 power-on reset (por) ............................................... 18 3.2.3 computer operating properly (cop) reset .... 18
MC68HC705MC4 specification rev. 1.5 motorola page iv section 4 interrupts ................................................................ 19 4.1 reset interrupt sequence .......................................... 21 4.2 software interrupt (swi) ............................................. 22 4.3 hardware interrupts .................................................... 22 4.3.1 external interrupt (irq) ......................................... 22 4.3.1.1 irqm - irq enable mask.............................................. 23 4.3.1.2 irqs - irq sensitivity................................................... 23 4.3.1.3 edge - irq active edge select ................................... 23 4.3.1.4 req - irq interrupt request ........................................ 23 4.3.1.5 ack - irq interrupt request acknowledge .................. 23 4.3.2 timer interrupts......................................................... 24 4.3.2.1 input capture interrupts ................................. 24 4.3.2.2 output compare interrupt............................... 25 4.3.2.3 timer overflow interrupt ................................ 25 4.3.3 sci interrupt ................................................................ 25 4.3.4 core timer (ctimer) interrupt .............................. 25 section 5 memory ....................................................................... 27 5.1 user mode memory map ................................................. 27 5.2 bootstrap/self-check mode memory map ............. 28 5.3 i/o and control registers ........................................... 28 5.4 ram ......................................................................................... 32 5.5 rom/eprom........................................................................... 32 section 6 input/output ports ............................................... 33 6.1 port a.................................................................................... 33 6.1.1 mcu line interface recommendations............... 33 6.2 port b.................................................................................... 34 6.3 port c.................................................................................... 35 6.4 port d.................................................................................... 36 6.5 i/o port programming .................................................... 36 section 7 analog subsystem ................................................ 39 7.1 analog section ................................................................. 39 7.1.1 ratiometric conversion.......................................... 39 7.1.2 v refh and v refl ................................................................... 39 7.1.3 accuracy and precision .......................................... 39 7.2 conversion process ...................................................... 39 7.3 digital section .................................................................. 39 7.3.1 conversion times........................................................ 39 7.3.2 multi-channel operation ........................................ 40 7.3.3 unused a/d inputs as i/o............................................ 40 7.4 a/d status and control register (adscr) $25 ...... 40 7.4.1 coco - conversions complete .............................. 40 7.4.2 adrc - a/d rc oscillator control........................ 41 7.4.3 adon - a/d on.................................................................. 41
MC68HC705MC4 specification rev. 1.5 motorola page v 7.4.4 ch3:ch0 - channel select bits ................................ 41 7.5 a/d data register ($24).................................................... 42 7.6 a/d during wait mode ...................................................... 42 7.7 a/d during stop mode ..................................................... 42 section 8 16-bit timer ................................................................ 43 8.1 timer ...................................................................................... 43 8.2 output compare ............................................................... 46 8.3 input captures.................................................................. 48 8.4 timer control register (tcr) ..................................... 49 8.4.1 icie2 - input capture interrupt enable 2........... 50 8.4.2 icie1 - input capture interrupt enable 1........... 50 8.4.3 toie - timer overflow interrupt enable........... 50 8.4.4 ocie - output compare interrupt enable ......... 50 8.4.5 tcmp/tcap1 ..................................................................... 50 8.4.6 iedg1 - input capture edge select 1.................... 50 8.4.7 iedg2 - input capture edge select 2.................... 50 8.4.8 olvl - output compare output level select .. 50 8.5 timer status register (tsr)......................................... 50 8.5.1 icf2 - input capture 2 flag ...................................... 51 8.5.2 icf1 - input capture 1 flag ...................................... 51 8.5.3 tof - timer overflow flag ...................................... 51 8.5.4 ocf - output compare flag..................................... 51 8.6 timer operation during wait/halt modes .............. 52 8.7 timer operation during stop mode .......................... 52 section 9 pulse width modulator ...................................... 53 9.1 pwm registers................................................................... 54 9.2 pwm control bits............................................................. 55 9.2.1 polx - polarity.............................................................. 55 9.2.2 rx[3:0] - pwm output rate select ........................... 56 9.2.3 csx[3:1] - channel select........................................... 57 9.2.4 mex - mask enable ........................................................ 57 9.2.5 mskx[3:1] - mask.............................................................. 58 9.2.6 updatex ........................................................................... 58 9.3 pwm data bits..................................................................... 59 9.4 pwm during resets.......................................................... 59 9.5 pwm operation in user mode....................................... 59 9.5.1 pwm data register ..................................................... 61 9.5.2 operation with different pwm rates ................ 61 9.5.3 operation with the same pwm rates .................. 62 9.6 pwm during wait mode ................................................... 62 9.7 pwm during stop mode................................................... 63 9.8 application examples ..................................................... 63 9.8.1 dc brush motor interface ..................................... 63 9.8.2 dc brushless motor interface ............................ 64
MC68HC705MC4 specification rev. 1.5 motorola page vi section 10 serial communications interface.................. 67 10.1 introduction...................................................................... 67 10.2 features .............................................................................. 67 10.3 sci data format ................................................................ 68 10.4 sci operation ..................................................................... 68 10.4.1 transmitter .................................................................. 68 10.4.1.1 character length........................................................... 68 10.4.1.2 character transmission ................................................ 68 10.4.1.3 break characters .......................................................... 70 10.4.1.4 idle characters .............................................................. 70 10.4.1.5 transmitter interrupts .................................................... 70 10.4.2 receiver ......................................................................... 70 10.4.2.1 character length........................................................... 71 10.4.2.2 character reception ..................................................... 71 10.4.2.3 receiver wakeup .......................................................... 72 10.4.2.4 receiver noise immunity .............................................. 72 10.4.2.5 framing errors .............................................................. 72 10.4.2.6 receiver interrupts ........................................................ 72 10.5 sci i/o registers................................................................ 73 10.5.1 sci data register (scdr) ................................................. 73 10.5.2 sci control register 1 (sccr1) ........................................ 73 10.5.3 sci control register 2 (sccr2) ........................................ 74 10.5.4 sci status register (scsr)............................................... 76 10.5.5 baud rate register (baud) ............................................... 78 section 11 core timer................................................................. 81 11.1 ctimer control and status register (ctcsr) $08 ........................................................................................... 82 11.1.1 ctof - core timer overflow flag...................................... 82 11.1.2 rtif - real time interrupt flag.......................................... 82 11.1.3 ctoie - core timer overflow interrupt enable.................. 82 11.1.4 rtie - real time interrupt enable ..................................... 82 11.1.5 rt1:rt0 - real time interrupt rate select........................ 83 11.2 computer operating properly (cop) watchdog reset ..................................................................................... 83 11.3 ctimer counter register (ctcr) $09......................... 83 11.4 core timer during wait mode...................................... 84 11.5 core timer during stop mode..................................... 84 section 12 electrical specifications ................................. 85 12.1 maximum ratings............................................................... 85 12.2 thermal characteristics ............................................. 85 12.3 dc electrical characteristics.................................. 86 12.4 a/d converter characteristics................................. 87 12.5 control timing .................................................................. 88
MC68HC705MC4 specification rev. 1.5 motorola page vii list of figures figure 1-1 block diagram....................................................................................... 2 figure 1-2 oscillator connections .......................................................................... 4 figure 2-1 user mode pinout ................................................................................. 8 figure 2-2 programmer interface to host............................................................... 9 figure 2-3 bootloader flowchart .......................................................................... 10 figure 2-4 programming circuit ........................................................................... 11 figure 2-5 eprom programming register.......................................................... 11 figure 2-6 mask option register ......................................................................... 12 figure 2-7 stop/wait flowcharts...................................................................... 15 figure 3-1 reset block diagram .......................................................................... 17 figure 3-2 cop watchdog timer register .......................................................... 18 figure 4-1 interrupt processing flowchart ........................................................... 21 figure 4-2 interrupt status and control register ................................................. 23 figure 4-3 interrupt hardware structure .............................................................. 24 figure 5-1 user mode memory map .................................................................... 28 figure 5-2 i/o and control registers memory map ............................................. 29 figure 5-3 i/o and control registers $0000-$000f ............................................. 30 figure 5-4 i/o and control registers $0010-$001f ............................................. 31 figure 5-5 i/o and control registers $0020-$002f ............................................. 32 figure 6-1 port a i/o circuitry .............................................................................. 33 figure 6-2 line interface circuitry ........................................................................ 34 figure 6-3 port b i/o circuitry .............................................................................. 35 figure 6-4 port c i/o circuitry.............................................................................. 35 figure 6-5 port d circuitry.................................................................................... 36 figure 7-1 a/d status and control register......................................................... 40 figure 7-2 a/d data register ............................................................................... 42 figure 8-1 16-bit timer block diagram ................................................................ 44 figure 8-2 timer registers (tmrh / tmrl) ........................................................ 45 figure 8-3 alternate counter registers (acrh / acrl) ..................................... 45 figure 8-4 state timing diagram for timer overflow........................................... 45 figure 8-5 output compare registers (ocrh / ocrl) ...................................... 46 figure 8-6 output compare software initialization example ............................... 47
MC68HC705MC4 specification rev. 1.5 motorola page viii figure 8-7 state timing diagram for output compare ........................................ 47 figure 8-8 input capture registers (icrh1 / icrl1)........................................... 48 figure 8-9 input capture registers (icrh2 / icrl2)........................................... 48 figure 8-10 state timing diagram for input capture ............................................. 49 figure 8-11 timer control register (tcr) ............................................................. 49 figure 8-12 timer status register (tsr)............................................................... 51 figure 9-1 pwm block diagram........................................................................... 53 figure 9-2 pwm ctl registers ........................................................................... 54 figure 9-3 pwma & pwmb data registers ........................................................ 54 figure 9-4 pwm waveforms (polx = 1) ............................................................. 55 figure 9-5 pwm waveforms (polx = 0) ............................................................. 56 figure 9-6 pwm output mux logic..................................................................... 58 figure 9-7 pwm control example........................................................................ 59 figure 9-8 pwm interlock mechanisms ............................................................... 60 figure 9-9 dc brush motor interface ................................................................... 63 figure 9-10 pwm register structure ..................................................................... 66 figure 10-1 sci data format ................................................................................. 68 figure 10-2 sci transmitter................................................................................... 69 figure 10-3 sci receiver....................................................................................... 71 figure 10-4 sci data register (scdr) ................................................................. 73 figure 10-5 sci control register 1 (sccr1) ........................................................ 73 figure 10-6 sci control register 2 (sccr2) ........................................................ 74 figure 10-7 sci status register (scsr) ............................................................... 76 figure 10-8 baud rate register (baud) ............................................................... 78 figure 11-1 core timer block diagram.................................................................. 81 figure 11-2 core timer control and status register (ctcsr) ............................. 82 figure 11-3 core timer counter register.............................................................. 84 figure 12-1 power-on reset and external reset timing diagram ....................... 89
MC68HC705MC4 specification rev. 1.5 motorola page ix list of tables table 2-1 operating mode conditions after reset................................................ 7 table 2-2 bootloader functions ............................................................................ 9 table 2-3 cop watchdog timer recommendations.......................................... 16 table 4-1 vector addresses for interrupts and reset......................................... 20 table 6-1 port a i/o pin functions ..................................................................... 37 table 6-2 port b i/o pin functions ..................................................................... 37 table 6-3 port c i/o pin functions ..................................................................... 37 table 6-4 port d i/o pin functions ..................................................................... 37 table 7-1 a/d channel assignments .................................................................. 42 table 9-1 pwm rate select table...................................................................... 57 table 9-2 dc brush motor truth table............................................................... 63 table 9-3 brushless dc motor commutation sequence .................................... 65 table 10-1 baud rate generator clock prescaling .............................................. 78 table 10-2 baud rate selection ........................................................................... 79 table 10-3 baud rate selection examples .......................................................... 80 table 11-1 rti rates............................................................................................ 83 table 11-2 minimum cop reset times ............................................................... 83
MC68HC705MC4 specification rev. 1.5 motorola page x
MC68HC705MC4 specification rev. 1.5 section 1: introduction motorola page 1 section 1 introduction the motorola MC68HC705MC4 microcontroller is a low-cost m68hc05 family eprom microprocessor intended for use in industrial motor control and power supply applications. it features a 2-channel, 8-bit high speed pwm module (including a commutation mux for brushless permanent magnet motor control), a 6 input, 8-bit a/d to accommodate analog feedback signals, and an sci to support multi-controller networking. this device is available in the 28-pin pdip and 28-pin soic package. 1.1 features (all timing based on 3 mhz bus) ? low cost, hc05 core running at 3 mhz bus speed (at v dd = 5 v +/- 10%) ? 28-pin pdip, soic or windowed ceramic package. low emi emission pinout ? 3584 bytes of user eprom (including eight user vectors of 2 bytes each) ? 176 bytes of user ram ? dual channel, high speed pwm featuring: - 8-bit resolution - independent prescaler frequency selection and period counters - 2 frequency ranges, 9 steps in each: a: 183 hz to 23.4 khz, b: 122 hz to 15.6 khz - s/w programmable pwm polarity - dual s/w controllable pwm output mux (each pwm to 3 i/o) ? 8-bit +/- 1lsb a/d converter with 6 input mux. high and low references. conversion rate = 10.7 m s ? 16-bit timer with 2 input captures or 1 input capture plus 1 output compare. resolution = 1.33 m s. input capture active edge s/w selectable as rising, falling, or both ? 15-stage multi-function core timer with timer overflow, real-time interrupt and watchdog ? asynchronous serial communications interface (sci) ? 22 general purpose i/o lines, some shared with peripheral functions ? one 8-bit high source current i/o port (10 ma/pin @ v dd -2.0 v, 20 ma max/port) (port a) ? one high sink current (10ma @ 1.0 v) output pin (pb7)
MC68HC705MC4 specification rev. 1.5 motorola section 1: introduction page 2 ? mask, request, acknowledge, edge and sensitivity (edge- and level-sensitive or edge-sensitive only) control/status bits for irq interrupt ? on-chip oscillator for crystal/ceramic resonator ? mask selectable cop watchdog system ? power saving stop and wait mode instructions (mask selectable stop instruction disable) ? illegal address reset ? steering diode on reset pin to v dd figure 1-1: block diagram user eprom/rom - 3584 bytes dual pwm registers and logic data direction reg internal clock a/ d converter 16-bit timer 1 input capture & 1 output compare or 2 input captures port d logic cop osc cond code reg 1 1 1 i n z c h index reg cpu control 0 0 0 stk pntr 1 1 0 0 0 0 0 ? 4 reset osc 1 osc 2 pd7/tcap2 sram - 176 bytes pd6/tc- mp/tcap1 irq/v pp alu 68hc05 cpu accum program counter cpu registers ? 2 pa6/pwmb3 pa0 pa7 pa1/pwma1 pa2/pwmb1 pa3/pwma2 pa4/pwmb2 pa5/pwma3 data direction reg pb5/rdi pb6 pb7 sci registers and logic data direction register pc3/ad3 pc4/ad4 pc5/ad5 pc6/v refh pc7/v refl pc2/ad2 port c mux pc1/ad1 pc0/ad0 v dd v ss pb4/tdo port a port b pwm prescalers bootstrap/self-check rom-240 bytes core timer
MC68HC705MC4 specification rev. 1.5 section 1: introduction motorola page 3 note: a line over a signal name indicates an active low signal. for example, reset is active high and reset is active low. 1.2 mask options there is one user selectable option on the mc68hc705. this option is provided through a bit within a mask option register in the eprom device, which is located and programmed at $0f00 as part of the eprom array. this option will be hard wired in the rom based device. the normal state of this option and its alternate state are: ? cop watchdog timer enabled. option to disable. the rom based device (mc68hc05mc4) will offer the following hard wired options: ? cop watchdog timer enabled. option to disable. ? stop instruction enabled. option to disable. in the eprom device, the stop instruction will be disabled. these options are compatible with the typical application environment in which the device is expected to be used and will consequently allow the otp devices to be used in production. 1.3 functional pin description the following paragraphs describe the functionality of each pin on the MC68HC705MC4 package. pins connected to subsystems described in other chapters provide a reference to the chapter instead of a detailed functional description. 1.3.1 v dd and v ss power is supplied to the mcu through v dd and v ss . v dd is connected to a regulated +5 volt supply and v ss is connected to ground. these pins are located close to each other for low electro magnetic interference (emi) emissions. very fast signal transitions occur on the mcu pins. the short rise and fall times place very high short-duration current demands on the power supply. to prevent noise problems, take special care to provide good power supply bypassing at the mcu. use bypass capacitors with good high-frequency characteristics, and position them as close to the mcu as possible. bypassing requirements vary, depending on how heavily the mcu pins are loaded. 1.3.2 osc1, osc2 these pins provide control input for an on-chip clock oscillator circuit. a crystal, a ceramic resonator or an external signal to these pins provides the system clock. the oscillator frequency is two times the internal bus rate.
MC68HC705MC4 specification rev. 1.5 motorola section 1: introduction page 4 the osc1 and osc2 pins can accept the following: ? a crystal as shown in figure 1-2: oscillator connections(a) ? a ceramic resonator as shown in figure 1-2: oscillator connections(a) ? an external clock signal as shown in figure 1-2: oscillator connections(b) the frequency, f osc , of the oscillator or external clock source is divided by two to produce the internal bus clock operating frequency, f op . the oscillator cannot be turned off by software if the stop disable option is enabled via mask option. 1.3.2.1 crystal with internal components the circuit in figure 1-2: oscillator connections(a) shows a typical oscillator circuit for an at-cut, parallel resonant crystal. follow the crystal manufacturers recommendations, as the crystal parameters determine the external component values required to provide maximum stability and reliable start-up. the load capacitance values used in the oscillator circuit design should include all stray capacitances. mount the crystal and components as close as possible to the pins for start-up stabilization and to minimize output distortion. figure 1-2: oscillator connections 1.3.2.2 ceramic resonator in cost-sensitive applications, use a ceramic resonator in place of a crystal. use the circuit in figure 1-2: oscillator connections(a) for a ceramic resonator and follow the resonator manufacturers recommendations, as the resonator parameters determine the external component values required for maximum stability and reliable starting. the load capacitance values used in the oscillator circuit design should include all stray capacitances. mount the resonator and components as close as possible to the pins for start-up stabilization and to minimize output distortion. to v dd (or stop) to v dd (or stop) (a) crystal or ceramic y resonator connections (b) external clock source connections osc1 osc2 mcu mcu osc1 osc2 unconnected external clock y : additional capacitance may be required for ceramic resonator option. follow the ceramic resonator manufacturers recommendations.
MC68HC705MC4 specification rev. 1.5 section 1: introduction motorola page 5 1.3.2.3 external clock an external clock from another cmos-compatible device can be connected to the osc1 input, with the osc2 input not connected, as shown in figure 1-2: oscillator connections (b) . 1.3.3 reset driving this input low will reset the mcu to a known start-up state. this pin can also be pulled low by internal resets. the reset pin contains an internal schmitt trigger to improve its noise immunity. refer to section 3: resets . 1.3.4 pa0, pa1/pwma1, pa2/pwmb1, pa3/pwma2, pa4/pwmb2, pa5/pwma3, pa6/pwmb3, pa7 these eight i/o pins comprise port a and are shared with the pwm subsystem. the state of any pin is software programmable and all port a lines are configured as inputs during power-on or reset. all port a pins have high source current capability to simplify interfacing to external devices, such as small triacs. refer to section 6: input/output ports and section 9: pulse width modulator . 1.3.5 pb4/tdo, pb5/rdi, pb6, pb7 these four i/o pins comprise port b. two pins are shared with the sci communication subsystem. the state of any pin is software programmable and all port b lines are configured as inputs during power-on or reset. refer to section 6: input/output ports and section 10: serial communications interface . 1.3.6 pc0:5/ad0:5, pc6/v refh , pc7/v refl these eight i/o pins comprise port c and are shared with the a/d converter subsystem. the state of any pin is software programmable and all port c lines are configured as inputs during power-on or reset. refer to section 6: input/output ports and section 7: analog subsystem . 1.3.7 pd6/tcap1/tcmp, pd7/tcap2 these two i/o pins comprise port d and are shared with the 16-bit timer subsystem. pd7 is always an input. pd6 can be used as an input or output port if the tcap1 interrupt is disabled and the tcap1/tcmp bit is clear in the tcr. this is the state upon reset. writes to pd7 have no effect. they may be read at any time, regardless of the mode of operation of the 16-bit timer. refer to section 6: input/output ports and section 8: 16-bit timer . 1.3.8 irq (maskable interrupt request) / v pp this pin has two different choices of interrupt triggering sensitivity through the irq bit in the interrupt status and control register (iscr). the choices are: ? edge-sensitive triggering only. ? both edge-sensitive and level-sensitive triggering.
MC68HC705MC4 specification rev. 1.5 motorola section 1: introduction page 6 in addition, the irq pin may be selected to trigger and interrupt on either the rising or falling edge of the irq pin signal through the edge bit in the iscr. the mcu completes the current instruction before it responds to the interrupt request. if the option is selected to include level-sensitive triggering, the irq input requires an external resistor to v dd for wire-or operation. the irq pin contains an internal schmitt trigger as part of its input to improve noise immunity. see section 4 interrupts . this pin is also used to supply the MC68HC705MC4 eprom array with the programming voltage. note: if the voltage level applied to the irq pin exceeds v dd it may affect the mcus mode of operation. see section 2: operating modes. 1.4 cpu core the MC68HC705MC4 uses a standard p-series cpu core. a description of the p-series instruction set can be found in mc68hc05p4 technical data (motorola publication mc68hc05p4/d).
MC68HC705MC4 specification rev. 1.5 section 2: operating modes motorola page 7 section 2 operating modes the MC68HC705MC4 has two modes of operation that affect the pin-out and architecture of the mcu: user mode and bootloader (eprom self-programming) mode. the user mode will normally be used, and the bootloader mode is required for the special needs of eprom programming. the mc68hc05mc4 also has two modes of operation that affect the pin-out and architecture of the mcu: user mode and selftest mode. the user mode will normally be used. the selftest mode is required for special needs, though selftest is specified for customer use. the conditions required to enter each mode are shown in table 2-1: operating mode conditions after reset . the mode of operation is determined by the voltages on the irq and pd7/tcap2 pins on the rising edge of the external reset pin. the mode of operation is also determined after internal resets, which pull low the reset pin. the mode of operation is determined at the subsequent rising edge of reset. table 2-1: operating mode conditions after reset 2.1 user mode the user mode allows the mcu to function as a self-contained microcontroller, with maximum use of the pins for on-chip peripheral functions. all address and data activity occurs within the mcu and are not available externally. user mode is entered on the rising edge of reset if the irq pin is within the normal operating voltage range. the pinout for the user mode is shown in figure 2-1: user mode pinout . v tst = 2 x v dd reset pin pd7/tcap2 mode irq/vpp v ss to v dd v tst v ss to v dd v dd user bootloader or selftest
MC68HC705MC4 specification rev. 1.5 motorola section 2: operating modes page 8 figure 2-1: user mode pinout in the user mode, port a shares 6 of its 8 i/o lines with the dual channel pwm subsystem. port b shares 2 of its 4 i/o lines with the sci subsystem. port c shares all of its 8-bit i/o lines with the a/d subsystem. port d shares its 2 i/o lines with the 16-bit timer subsystem. 2.2 bootloader mode bootloader mode is entered upon the rising edge of reset if the irq/v pp pin is at v pp and the pd7/tcap2 pin is at logic one. the bootloader code resides in rom between $0f01 to $0fef. this program handles copying of user code from an external eprom or host computer into the on-chip eprom. figure 2-2: programmer interface to host shows the timing required to interface the device being programmed to a host. the bootloader performs one programming pass at t epgm per byte. when programming is complete, the bootloader code then performs a verify pass. disable the cop hardware in bootloader mode. the external user code addresses must correspond directly with the internal eprom addresses. 2.2.1 bootloader functions three pins are used to select various bootloader functions. these pins are pc0, pc2, and pc3. pc0 is a sync pin, which is used to synchronize the mcu to an off-chip source driving eprom data into the mcu. if an external eprom is used, this pin must be connected to v ss . pc2 and pc3 are used to select a programming mode. two other pins, pc6 and pc7 are used to drive the prog led and the verf led respectively. the pc2, pc3 configurations required to enter the programming modes are shown in table 2-2: bootloader functions . alternatively, if pc1 is at a logic high after exiting reset, a jump to ram at address $0050 will be executed instead of the bootstrap firmware. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 28 27 26 25 24 23 22 21 20 19 18 17 16 15 pc0/ad0 pc1/ad1 pc2/ad2 pc3/ad3 pb7 pb6 pb5/rdi pb4/td0 pd7/tcap2 pd6/tcmp/tcap1 pc7/v refl pc6/v refh pc5/ad5 pc4/ad4 irq/v pp reset osc1 osc2 v ss v dd pa6/pwmb3 pa5/pwma3 pa4/pwmb2 pa3/pwma2 pa2/pwmb1 pa1/pwma1 pa7 pa0
MC68HC705MC4 specification rev. 1.5 section 2: operating modes motorola page 9 table 2-2: bootloader functions the bootloader uses an external 12-bit counter to address the external memory device containing the code to be copied. this counter requires a clock and a reset function and can address up to 4k bytes of memory. figure 2-2: programmer interface to host pc0 pc2 pc3 mode sync sync sync 1 0 1 program/verify verify only dump eprom 1 00 data out port a clk (out) sync (in) host read data (a) dump eprom interface to a host clk (out) sync (in) data in (b) program/verify interface to a host data read
MC68HC705MC4 specification rev. 1.5 motorola section 2: operating modes page 10 figure 2-3: bootloader flowchart boot pc1=0 jump to ram put ramsub in ram get byte from port a program byte jsr nextaddr gate stress drain stress ddra=output get byte start @ $100 put byte on port a change instruction from sta to eor inc count to $100 start addr <- $100 get byte from port a jsr ramsub jsr nextaddr end address ($0fff) end address ($0fff) wait wait pc0=1 (sync) wait verify led on compare end addr ($0fff) pc2=1 pc3=1 pc2=1 pc0=1 yes yes no yes no yes yes yes yes yes yes no no no no no no no no yes dump eprom prg/verf verify mayprg bump count to $100 bump count to $100 initialize i/o ports jsr nextaddr
MC68HC705MC4 specification rev. 1.5 section 2: operating modes motorola page 11 figure 2-4: programming circuit 2.2.2 eprom programming register this register is used to program the eprom array. to program a byte of eprom, set latch, then write data to the desired address, then set epgm for t epgm . figure 2-5: eprom programming register v dd a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 clk rst pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 mc14040b d0 d1 d2 d3 d4 d5 d6 d7 osc1 osc2 reset pc0 pc7 pc6 pc4 pc5 irq/v pp prog verf 2764 ce oe (sync) pc3 pc2 pc1 v dd v dd v dd v dd v pp 6.0 mhz 8 7 9 11 12 18 17 13 14 15 16 5 3 2 1 28 27 26 25 10 9 8 7 6 5 4 3 25 24 21 23 2 9 7 6 5 3 2 4 13 12 14 15 1 11 10 10 11 12 13 15 16 17 18 19 20 22 all resistors are 10 k w unless specified otherwise 390 w 390 w v dd 16 8 v ss v dd 4 6 14 28 27 1 v dd 47k w 0.1uf 0.1uf + 10uf to decouple v dd /v ss 0 0 0 0 0 latch programming register bootstrap mode $0026 w r epgm unimplemented read write addr 1 0 2 3 4 5 6 7 register 0
MC68HC705MC4 specification rev. 1.5 motorola section 2: operating modes page 12 2.2.2.1 latch - eprom latch control the latch bit is a read/write bit. when set, the address and data buses are latched when a write to eprom is done. eprom cannot be read if latch = 1. 1 = eprom address and data bus configured for programming. 0 = eprom address and data bus configured for normal reads. 2.2.2.2 epgm - eprom program control the epgm bit may be read or cleared at any time. it may only be set if latch=1. if latch=0, the epgm is automatically cleared. latch and epgm cannot both be set on the same write. 1 = programming power switched on to the eprom array. 0 = programming power switched off the eprom array. 2.2.3 mask option register (mor) $0f00 this register is latched upon reset and at regular intervals as determined by cop timeout period. it is an eprom byte located at $0f00 and holds the option bit for cop disable/enable. figure 2-6: mask option register 2.2.3.1 cop - cop enable/disable 1 = the cop is enabled. 0 = (erased state) the cop is disabled. u u u u u cope u cope mor $0f00 7 w r 6543210 u 00000000 reset t unimplemented u = undetermined
MC68HC705MC4 specification rev. 1.5 section 2: operating modes motorola page 13 2.3 self-check the mc68hc05mc4 self-check operating mode will be defined in a subsequent revision of this specification. 2.4 low-power modes MC68HC705MC4 is capable of running in a low-power mode in each of its configurations. the wait and stop instructions provide two modes that reduce the power required for the mcu by stopping various internal clocks and/or the on-chip oscillator. the stop and wait instructions are not normally used if the cop watchdog timer is enabled. if the stop instruction is disabled, unintentional or otherwise execution of a stop instruction will have no effect. the flow of the stop and wait modes is shown in figure 2-7: stop/wait flowcharts . note: stop is always disabled in the MC68HC705MC4. 2.4.1 stop instruction the stop instruction can result in one of two modes of operation depending on the mask option. if the stop disable option is not chosen, the stop instruction will behave like a normal stop instruction in the mc68hc05 family and place the mcu in the stop mode. if the stop disable option is chosen, the stop instruction will be treated as a nop instruction and will have no effect. 2.4.1.1 stop mode execution of the stop instruction when enabled places the mcu in its lowest power consumption mode. in the stop mode, the internal oscillator is turned off, halting all internal processing, including the cop watchdog timer. execution of the stop instruction automatically clears the interrupt mask bit (i-bit) in the condition code register so that the irq external interrupt is enabled. all other registers and memory remain unaltered. all input/output lines remain unchanged. the mcu can be brought out of the stop mode only by an irq external interrupt or an externally generated reset. when exiting the stop mode the internal oscillator will resume after a 4064 bus clock cycle oscillator stabilization delay. note: if the irq mask bit (irqm) in the interrupt control and status register is set before entering stop mode, an active edge on irq will not bring the processor out of stop.
MC68HC705MC4 specification rev. 1.5 motorola section 2: operating modes page 14 note: execution of the stop instruction with stop enabled (via mask option) will cause the oscillator to stop, and therefore disable the cop watchdog timer. if the cop watchdog timer is to be used, the stop mode should be disabled by selecting the appropriate mask option. 2.4.2 wait instruction the wait instruction places the mcu in a low-power mode, which consumes more power than the stop mode. in wait mode, the bus clock is halted, suspending all processor and internal bus activity but the timer, pwm, a/d, sci, and cop subsystems remain active. the user may optionally disable each individual subsystem through software before entering wait mode in order to save more power. execution of the wait instruction automatically clears the i-bit in the condition code register enabling the irq external interrupt. all other registers, memory, and input/output lines remain in their previous state unless modified by an active peripheral. if the 16-bit timer interrupt is enabled it will cause the processor to exit the wait mode and resume normal operation. the 16-bit timer may be used to generate a periodic exit from the wait mode. the wait mode may also be exited when an irq external interrupt, sci interrupt, or reset occurs.
MC68HC705MC4 specification rev. 1.5 section 2: operating modes motorola page 15 figure 2-7: stop/wait flowcharts 2.5 cop watchdog timer considerations the cop watchdog timer is active in single chip mode of operation when selected by mask option. executing the stop instruction when stop mode is enabled (via mask option) will cause the cop to be disabled. therefore, it is recommended that if the cop watchdog timer is to be used, the stop mode should be disabled by selecting the appropriate mask option. 1. fetch reset vector or 2. service interrupt a. stack b. set i-bit c. vector to interrupt routine wait stop disable mask option? y n external reset? y n irq external interrupt? y n stop external oscillator, stop internal timer clock, reset start-up delay restart external oscillator, start stabilization delay stop internal processor clock, clear i-bit in ccr end of stabilization delay? y n cop internal interrupt? y n external oscillator active and internal timer clock active restart internal processor clock stop internal processor clock, clear i-bit in ccr irq external interrupt? y n external reset? y n stop timer internal reset? y n fetch and process next instruction core timer internal interrupt? y n sci internal reset? y n
MC68HC705MC4 specification rev. 1.5 motorola section 2: operating modes page 16 the cop watchdog timer should be disabled for applications that will use the wait mode with time periods that will exceed the cop time-out period. cop watchdog timer interactions are summarized in table 2-3: cop watchdog timer recommendations . table 2-3: cop watchdog timer recommendations wait period less than cop time-out stop instruction mode wait period then the cop watchdog timer should be: disable cop via mask option stop mode disabled via mask option enable or disable cop via mask option wait period more than cop time-out any length wait period stop mode disabled via mask option disable cop via mask option stop mode enabled via mask option if the following conditions exist:
MC68HC705MC4 specification rev. 1.5 section 3: resets motorola page 17 section 3 resets the mcu can be reset from four sources: one external input and three internal reset conditions. the reset pin is an input with a schmitt trigger as shown in figure 3-1: reset block diagram . the cpu and all peripheral modules will be reset by the rst signal which is the logical or of internal reset functions and is clocked by the internal bus clock. the reset pin will also be pulled low by internal reset for 4 bus cycles. figure 3-1: reset block diagram 3.1 external reset ( reset) the reset input is the only external reset and is connected to an internal schmitt trigger. the external reset occurs whenever the reset input is driven below the lower threshold and remains in reset until the reset pin rises above the upper threshold. the upper and lower thresholds are given in section 12: electrical specifications . 3.2 internal resets the three internally generated resets are the illegal address, the initial power-on reset (por) function, and the cop watchdog timer function. 3.2.1 illegal address reset when an opcode fetch occurs at an address that is not in the ram or rom/eprom the part automatically resets. the part will also reset when an opcode fetch inadvertantly occurs at an address within the self-check/bootstrap rom while the device is in user mode. reset rst power-on reset (por) reset cop watchdog (copr) v dd osc data address latch to cpu and peripherals internal clock lir address illegal address 4 cycle counter
MC68HC705MC4 specification rev. 1.5 motorola section 3: resets page 18 3.2.2 power-on reset (por) an internal reset is generated on power-up to allow the internal clock generator to stabilize. the power-on reset is strictly for power turn-on conditions and should not be used to detect a drop in the power supply voltage. there is a 4064 internal processor clock cycle (t cyc ) oscillator stabilization delay after the oscillator becomes active. if the reset pin is active at the end of this 4064 cycle delay, the mcu will remain in the reset condition until reset goes inactive. the por will generate the rst signal and reset the mcu. if any other reset function is active at the end of this 4064 internal clock cycle delay, the rst signal will remain active until the other reset condition(s) end. 3.2.3 computer operating properly (cop) reset when the cop watchdog timer is enabled (by mask option) the internal cop reset is generated automatically by a time-out of the cop watchdog timer. this timer is implemented as part of the core timer. see section 11: core timer . the cop watchdog counter is cleared by writing a logical zero to bit zero at location $0ff0. the cop watchdog timer can be disabled by mask option or by applying 2 v dd to the irq pin at the rising edge of reset (e.g. during self-check operation). when the irq pin is returned to its normal operating voltage range (between v ss - v dd ) at the rising edge of reset, the cop watchdog timers output will be restored if the cop mask option is enabled. the cop register is shared with the msb of the core timer interrupt vector as shown in figure 3-2: cop watchdog timer register . reading this location will return the msb of the core timer interrupt vector. writing to this location will clear the cop watchdog timer. figure 3-2: cop watchdog timer register 0 0 0 0 0 0 0 copr copr $0ff0 7 w r 6543210 0 00000000 reset t unimplemented
MC68HC705MC4 specification rev. 1.5 section 4: interrupts motorola page 19 section 4 interrupts the mcu can be interrupted eight different ways: 1. nonmaskable software interrupt instruction (swi) 2. external asynchronous interrupt ( irq) 3. input capture interrupt (timer) 4. output compare interrupt (timer) 5. timer overflow interrupt (timer) 6. serial communications interrupt (sci) 7. core timer overflow interrupt (ctimer) 8. real time interrupt (ctimer) interrupts cause the processor to save the register contents on the stack and to set the interrupt mask (i-bit) to prevent additional interrupts. unlike reset, hardware interrupts do not cause the current instruction execution to be halted, but are considered pending until the current instruction is completed. when the current instruction is completed, the processor checks all pending hardware interrupts. if interrupts are not masked (i-bit in the condition code register is clear), and the corresponding interrupt enable bit is set, the processor proceeds with interrupt processing. otherwise, the next instruction is fetched and executed. the swi is executed the same as any other instruction, regardless of the i-bit state. when an interrupt is to be processed, the cpu puts the register contents on the stack, sets the i-bit in the ccr, and fetches the address of the corresponding interrupt service routine from the vector table at locations $0ff0 thru $0fff. if more than one interrupt is pending when the interrupt vector is fetched, the interrupt with the highest vector location shown in table 4-1: vector addresses for interrupts and reset will be serviced first. an rti instruction is used to signify when the interrupt software service routine is completed. the rti instruction causes the cpu state to be recovered from the stack and normal processing to resume at the next instruction that was to be executed when the interrupt took place. figure 4-1: interrupt processing flowchart shows the sequence of events that occur during interrupt processing. the interrupts fall into three categories: reset, software, and hardware.
MC68HC705MC4 specification rev. 1.5 motorola section 4: interrupts page 20 table 4-1: vector addresses for interrupts and reset register n/a n/a iscr tsr tsr tsr tsr scsr ctcsr ctcsr flag name n/a n/a req icf2 icf1 ocf tof various ctof rtif interrupts reset software external interrupt timer input capture 2 timer input capture 1 timer output compare * timer overflow * sci core timer overflow * core timer real time * cpu interrupt reset swi irq timer timer timer timer sci ctimer ctimer vector address $0ffe-$0fff $0ffc-$0ffd $0ffa-$0ffb $0ff8-$0ff9 $0ff6-$0ff7 $0ff4-$0ff5 $0ff4-$0ff5 $0ff2-$0ff3 $0ff0-$0ff1 $0ff0-$0ff1 * vector is shared
MC68HC705MC4 specification rev. 1.5 section 4: interrupts motorola page 21 figure 4-1: interrupt processing flowchart 4.1 reset interrupt sequence the reset function is not in the strictest sense an interrupt; however, it is acted upon in a similar manner as shown in figure 4-1: interrupt processing flowchart . a low level input on the reset pin or internally generated rst signal causes the program to vector to its starting address which is specified by the contents of memory locations $0ffe and $0fff. the i-bit in the condition code register is also set. the mcu is configured to a known state during this type of reset, as previously described in section 3: resets . is i-bit set? from reset load pc from: swi: $0ffc, $0ffd irq: $0ffa-$0ffb tmr ic2: $0ff8-$0ff9 tmr ic1:$0ff6-$0ff7 tmr oc/of:$0ff4-$0ff5 sci: $0ff2-$0ff3 ctmr: $0ff0-$0ff1 set i-bit in ccr stack pc, x, a, cc clear irq request latch restore resistors from stack cc, a, x, pc y n execute instruction fetch next instruction irq interrupt? y n timer interrupt? y n swi instruction? y n rti instruction? y n sci interrupt? y n core timer interrupt? y n
MC68HC705MC4 specification rev. 1.5 motorola section 4: interrupts page 22 4.2 software interrupt (swi) the swi is an executable instruction. it is also a non-maskable interrupt since it is executed regardless of the state of the i-bit in the ccr. as with any instruction, interrupts pending during the previous instruction will be serviced before the swi opcode is fetched. the interrupt service routine address for the swi instruction is specified by the contents of memory locations $0ffc and $0ffd. 4.3 hardware interrupts all hardware interrupts are maskable by the i-bit in the ccr. if the i-bit is set, all hardware interrupts (internal and external) are disabled. clearing the i-bit enables the hardware interrupts. there are four hardware interrupts that are explained in the following sections. 4.3.1 external interrupt (irq) if the interrupt mask bit (i-bit) of the ccr is set, all maskable interrupts (internal and external) are disabled. clearing the i-bit enables interrupts (subject to their individual interrupt enable control flag status). irq now has an independent interrupt mask bit in the interrupt status and control register (iscr) that must also be cleared to enable its corresponding interrupt. the interrupt mask bit operates by inhibiting the interrupt signal after the appropriate interrupt request latch. this feature allows the interrupt to be recognized and latched even if the mask is set. when the irq input goes to the active level for at least one t ilih , a logic one is latched internally to signify an interrupt has been requested. when the mcu completes its current instruction, the interrupt latch is tested. if the interrupt latch contains a logic one, and the interrupt mask bit (i-bit) in the condition code register and the irq mask bit (irqm) in the iscr are both clear, then the mcu can begin the interrupt sequence. the state of the interrupt latch is reflected in the interrupt request bit (req) in the iscr, and is automatically cleared during interrupt processing. see figure 4-2: interrupt status and control register . irq interrupt requests are automatically acknowledged and cleared during interrupt processing. it may also be cleared through software by setting the acknowledge bit in the iscr. setting this bit is a one-shot operation and will not affect subsequent interrupt operation. the action of clearing the acknowledge bit will clear the request bit. this allows the programmer the option to cancel spurious interrupts that occur while the interrupt mask bits are set. this may be necessary in systems where it is desirable to prevent redundant (ghost) entries to the interrupt service routine (where the interrupt mask is eventually cleared).
MC68HC705MC4 specification rev. 1.5 section 4: interrupts motorola page 23 note that the irqm is cleared (enabled) during reset, although no interrupts can occur until the interrupt mask bit of the ccr is cleared. it is set during reset. the interrupt request latches are also cleared during reset. figure 4-2: interrupt status and control register 4.3.1.1 irqm - irq enable mask the irqm bit is a read/write bit that will disable the irq interrupt when set. irqm is cleared by reset. 1 = irq interrupt request disabled 0 = irq interrupt request enabled 4.3.1.2 irqs - irq sensitivity the irqs bit is a read/write bit that will select whether the irq interrupt is edge-sensitive only or both edge-sensitive and level-sensitive. irqs is cleared by reset. 1 = both edge-sensitive and level-sensitive 0 = edge-sensitive only 4.3.1.3 edge - irq active edge select the edge bit is a read/write bit that allows the user to select which edge, rising or falling, of the signal at the irq pin will generate an interrupt. both rising and falling edge sensitivity may be achieved in software by toggling the edge bit from within the irq service routine. edge is cleared by reset. 1 = rising edge irq interrupt 0 = falling edge irq interrupt 4.3.1.4 req - irq interrupt request the req bit is a read-only bit. the irq interrupt request bit and latch are cleared during irq exception processing. therefore, one external irq interrupt pulse can be latched and subsequently serviced as soon as the i-bit is cleared. req will be cleared by reset. 1 = irq interrupt request pending 0 = no irq interrupt request pending 4.3.1.5 ack - irq interrupt request acknowledge this bit is write only - it will always read as a zero. writing a one to this bit will acknowledge the interrupt by clearing the corresponding interrupt request bit. iscr $000f 7 w r 6543210 ack req edge irqm 0 00000000 reset t 0 0 irqs 0
MC68HC705MC4 specification rev. 1.5 motorola section 4: interrupts page 24 note: the use of separate request and acknowledge bits allows the safe use of read-modify-write instructions (for example, bset, bclr) on the iscr register. figure 4-3: interrupt hardware structure note: when the edge- and level-sensitive mask option is selected, the voltage applied to the irq pin must return to the inactive state before the rti instruction in the interrupt service routine is executed. if the irq pin remains in at the active level, the interrupt service routine will be re-entered after the rti is executed. setting the ack bit will have no effect under these circumstances. 4.3.2 timer interrupts 4.3.2.1 input capture interrupts the input capture interrupts are generated by the 16-bit timer as described in section 8: 16-bit timer . the input capture interrupt flags are located in register tsr and the corresponding enable bits can be found in register tcr. the i-bit in the ccr must be clear in order for either input capture interrupt to be enabled. the interrupt service routine ack req clear q d v dd interrupt irq edge edge- and level-sensitive irqs irqm
MC68HC705MC4 specification rev. 1.5 section 4: interrupts motorola page 25 addresses are specified by the contents of memory locations $0ff8 and $0ff9 for input capture 2, and by the contents of memory locations $0ff6 and $0ff7 for input capture 1. 4.3.2.2 output compare interrupt the output compare interrupt is generated by the 16-bit timer, as described in section 8: 16-bit timer . the output compare interrupt flag is located in register tsr and its corresponding enable bit can be found in register tcr. the i-bit in the ccr must be clear in order for the output compare interrupt to be enabled. the interrupt service routine address is specified by the contents of memory locations $0ff4 and $0ff5. 4.3.2.3 timer overflow interrupt the timer overflow interrupt is generated by the 16-bit timer as described in section 8: 16-bit timer . the timer overflow interrupt flag is located in register tsr and its corresponding enable bit can be found in register tcr. the i-bit in the ccr must be clear in order for the timer overflow interrupt to be enabled. this internal interrupt will vector to the interrupt service routine located at the address specified by the contents of memory locations $0ff4 and $0ff5. the timer overflow and the output compare function share the same interrupt vector, thus requiring the user to poll interrupt request flags. 4.3.3 sci interrupt there are five different sci interrupt flags that cause an sci interrupt whenever they are set and enabled. the interrupt flags are in the sci status register (scsr), and the enable bits are in the sci control register 2 (sccr2). any of these interrupts will vector to the same interrupt service routine, located at the address specified by the contents of memory location $0ff2 and $0ff3. see section 10: serial communications interface . 4.3.4 core timer (ctimer) interrupt there are two different core timer interrupt flags that cause a ctimer interrupt whenever they are set and enabled. the interrupt flags and enable bits are located in the ctimer control and status register (ctcsr). any of these interrupts will vector to the same interrupt service routine, located at the address specified by the contents of memory location $0ff0 and $0ff1. see section 11: core timer .
MC68HC705MC4 specification rev. 1.5 motorola section 4: interrupts page 26 this page intentionally left blank
MC68HC705MC4 specification rev. 1.5 section 5: memory motorola page 27 section 5 memory the MC68HC705MC4 utilizes 12 address lines to access an internal memory space of 4k bytes. this memory space is divided into i/o, ram, and eprom/rom areas. 5.1 user mode memory map when the mc68hc05mc4 is in the user mode, the 48 bytes of i/o, 176 bytes of ram, 3584 bytes of user rom, 240 bytes of self-check rom, and 16 bytes of user vectors rom are all active, as shown in figure 5-1: user mode memory map . when the MC68HC705MC4 is in the user mode, the 48 bytes of i/o, 176 bytes of ram, 3584 bytes of user eprom, 240 bytes of bootstrap rom, and 16 bytes of user vectors eprom are all active, as shown in figure 5-1: user mode memory map . the mask option (mor) and eprom programming (eprog) registers are unique to the MC68HC705MC4 and are therefore unimplemented in the mc68hc05mc4. the mor resides at address $0f00 (first byte of the bootstrap code area) and the eprog register resides at $0026.
MC68HC705MC4 specification rev. 1.5 motorola section 5: memory page 28 figure 5-1: user mode memory map 5.2 bootstrap/self-check mode memory map memory space is identical to the user mode, as shown in figure 5-1: user mode memory map . 5.3 i/o and control registers figure 5-2: through figure 5-5: briefly describe the i/o and control registers at locations $0000-$002f. reading unimplemented bits will return unknown states, and writing unimplemented bits will be ignored. reset vector (low byte) reset vector (high byte) swi vector (low byte) swi vector (high byte) irq vector (low byte) irq vector (high byte) timer vector 2(low byte) timer vector 2(high byte) timer vector 1(low byte) timer vector 1(high byte) $0ff6 $0ff7 $0ff8 $0ff9 $0ffa $0ffb $0ffc $0ffd $0ffe $0fff sci vector (low byte) $0ff5 sci vector (high byte) $0ff4 $0ff3 $0ff2 ctimer vector (low byte) $0ff1 ctimer vector (high byte) / $0ff0 $002f $0000 $0100 $00ff stack 64 bytes internal ram 176 bytes i/o 48 bytes user vectors eprom/rom 16 bytes $0fff $0ff0 $0fef $0f00 $0eff $00c0 $00bf $0050 $004f $0030 $002f $0000 self-check/ bootstrap rom and vectors 240 bytes user eprom/ rom 3584 bytes unused i/o registers see figure 5-2: timer vector 3(low byte) timer vector 3(high byte) cop control register
MC68HC705MC4 specification rev. 1.5 section 5: memory motorola page 29 figure 5-2: i/o and control registers memory map ** eprom device only, unimplemented on rom device port a data register $0000 port b data register $0001 port c data register $0002 port d data register $0003 port a data direction register $0004 port b data direction register $0005 port c data direction register $0006 port d data direction register $0007 core timer control & status register $0008 core timer counter register $0009 sci baud $000a sci control 1 $000b sci control 2 $000c sci status $000d sci data $000e irq status/control $000f pwma data-direct $0010 pwma data-interlock $0011 pwmb data-direct $0012 pwmb data-interlock $0013 pwm ctl-a $0014 pwm ctl-b $0015 pwm rate $0016 timer control register $0017 timer status register $0018 input capture2 msb $0019 input capture2 lsb $001a input capture1 msb $001b input capture1 lsb $001c output compare msb $001d output compare lsb $001e reserved for test $001f timer msb $0020 timer lsb $0021 alternate counter msb $0022 alternate counter lsb $0023 a/d converter data register $0024 a/d control & status register $0025 eprom program register ** $0026 pwm update register $0027 unimplemented $0028 $002f
MC68HC705MC4 specification rev. 1.5 motorola section 5: memory page 30 figure 5-3: i/o and control registers $0000-$000f unimplemented register addr r/w 7 6543210 port a $0000 r pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 port a data register w port b $0001 r pb7 pb6 pb5 pb4 0 0 0 0 port b data register w port c $0002 r pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 port c data register w port d $0003 r pd7 pd6 000000 port d data register w port a data direction register $0004 r ddra7 ddra6 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 w port b data direction register $0005 r ddrb7 ddrb6 ddrb5 ddrb4 0 0 0 0 w port c data direction register $0006 r ddrc7 ddrc6 ddrc5 ddrc4 ddrc3 ddrc2 ddrc1 ddrc0 w port d data direction register $0007 r ddrd6 w core timer control & status register $0008 r ctof rtif ctoie rtie 0 0 rt1 rt0 w core timer counter register $0009 r ctcr7 ctcr6 ctcr5 ctcr4 ctcr3 ctcr2 ctcr1 ctcr0 w sci baud $000a r 0 0 scp1 scp0 0 scr2 scr1 scr0 w sci control 1 $000b r r8 t8 0 m wake 0 0 0 w sci control 2 $000c r tie tcie rie ilie te re rwu sbk w sci status $000d r tdre tc rdrf idle or nf fe 0 w sci data $000e r sc7 sc6 sc5 sc4 sc3 sc2 sc1 sc0 w irq status/control $000f r irqm irqs edge 0 req 0 0 0 w ack
MC68HC705MC4 specification rev. 1.5 section 5: memory motorola page 31 figure 5-4: i/o and control registers $0010-$001f unimplemented reserved for test register addr r/w 7 6 5 4 3 2 1 0 pwma data (effective) $0010 r pwma7 pwma6 pwma5 pwma4 pwma3 pwma2 pwma1 pwma0 pwma data-direct w pwma data (effective) $0011 r pwma data-interlock w pwmb data (effective) $0012 r pwmb7 pwmb6 pwmb5 pwmb4 pwmb3 pwmb2 pwmb1 pwmb0 pwmb data-direct w pwmb data (effective) $0013 r pwmb data-interlock w pwm ctl-a (effective) $0014 r mea pola mska3 mska2 mska1 csa3 csa2 csa1 pwm ctl-a (buffer) w pwm ctl-b (effective) $0015 r meb polb mskb3 mskb2 mskb1 csb3 csb2 csb1 pwm ctl-b (buffer) w pwm rate (effective) $0016 r ra3 ra2 ra1 ra0 rb3 rb2 rb1 rb0 pwm rate (buffer) w timer control register $0017 r icie2 icie1 toie ocie tcmp/ tcap1 iedg1 iedg2 olvl w timer status register $0018 r icf2 icf1 tof ocf 0 0 0 0 w input capture2msb $0019 r ic2h7 ic2h6 ic2h5 ic2h4 ic2h3 ic2h2 ic2h1 ic2h0 w input capture2lsb $001a r ic2l7 ic2l6 ic2l5 ic2l4 ic2l3 ic2l2 ic2l1 ic2l0 w input capture1msb $001b r ic1h7 ic1h6 ic1h5 ic1h4 ic1h3 ic1h2 ic1h1 ic1h0 w input capture1lsb $001c r ic1l7 ic1l6 ic1l5 ic1l4 ic1l3 ic1l2 ic1l1 ic1l0 w output comparemsb $001d r och7 och6 och5 och4 och3 och2 och1 och0 w output comparelsb $001e r ocl7 ocl6 ocl5 ocl4 ocl3 ocl2 ocl1 ocl0 w reserved for test $001f r w
MC68HC705MC4 specification rev. 1.5 motorola section 5: memory page 32 figure 5-5: i/o and control registers $0020-$002f 5.4 ram the user ram consists of 176 bytes (including the stack) at locations $0050 thru $00ff. the stack begins at address $00ff. the stack pointer can access 64 bytes of ram from $00ff to $00c0. note: using the stack area for data storage or temporary work locations requires care to prevent it from being overwritten due to stacking from an interrupt or subroutine call. 5.5 rom/eprom there are 3584 bytes of user rom/eprom at locations $0100 thru $0eff and 16 additional bytes for user vectors at locations $0ff0 thru $0fff. the self-check/bootstrap rom and vectors are at locations $0f00 thru $0fef. ** eprom device only, unimplemented on rom device register addr r/w 7 6543210 timer msb $0020 r tmrh7 tmrh6 tmrh5 tmrh4 tmrh3 tmrh2 tmrh1 tmrh0 w timer lsb $0021 r tmrl7 tmrl6 tmrl5 tmrl4 tmrl3 tmrl2 tmrl1 tmrl0 w alternate counter msb $0022 r acrh7 acrh6 acrh5 acrh4 acrh3 acrh2 acrh1 acrh0 w alternate counter lsb $0023 r acrl7 acrl6 acrl5 acrl4 acrl3 acrl2 acrl1 acrl0 w a/d converter data register $0024 r ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 w a/d control/status register $0025 r coco adrc adon 0 ch3 ch2 ch1 ch0 w eprom prog register ** $0026 r 0 00000 latch epgm w pwm force register $0027 r w forcea unimplemented $0028-$002f r w forceb
MC68HC705MC4 specification rev. 1.5 section 6: input/output ports motorola page 33 section 6 input/output ports in the user mode, there are 20 bidirectional i/o lines arranged as two 8-bit i/o ports (ports a and c), one 4-bit i/o port (port b), and one 2-bit input port (port d). these ports are programmable as either inputs or outputs, except port d7, under software control of the data direction registers (ddrs). 6.1 port a port a is an 8-bit bidirectional port that shares pa1-pa6 with the pwm subsystem. (see figure 6-1: port a i/o circuitry .) the port a data register is located at address $0000 and its data direction register (ddr) is located at address $0004. reset does not affect the data registers, but clears the ddrs, thereby setting all of the port pins to input mode. writing a one to a ddr bit sets the corresponding port pin to output mode. pa1-pa6 may be used for general i/o applications when the pwm subsystem is disabled. pa0-7 feature larger p-channel output devices and are capable of sourcing more current than a standard port (refer to section 12: electrical specifications ). figure 6-1: port a i/o circuitry 6.1.1 mcu line interface recommendations it is expected that some applications appropriate to the MC68HC705MC4 will be required to determine the presence of line (mains) voltage using the mcu. a low-cost mcu line interface is shown in figure 6-2: line interface circuitry . pa7 has been intentionally located between v dd and v ss to provide a lowest possible impedance path for the injected currents in particular fast transients. although any i/o port will function in this manner, it is recommended that only pa7 be used for such an interface. the positive and negative excursions of the input voltage relative to the neutral return are clamped between v ss and v dd using the internal parasitic input diodes. the series resistor limits the injected currents to the specified value. (refer to section 12 electrical specifications .) the resistor value must be calculated based upon maximum expected transient voltage levels read $0000 write $0000 read $0004 data register bit i/o pin output internal hc05 data bus reset (rst) write $0004 data direction register bit
MC68HC705MC4 specification rev. 1.5 motorola section 6: input/output ports page 34 (i.e., not line peak values). care should be taken to ensure parasitic series resistor and pcb capacitance will not couple transients to the mcu input. pa7 has been intentionally located between v dd and v ss to provide a lowest possible impedance path for the injected currents, in particular fast transients. although any i/o port will function in this manner, it is recommended that only pa7 be used for such an interface. figure 6-2: line interface circuitry 6.2 port b port b is a 4-bit bidirectional port that can share pins pb4-pb5 with the sci subsystem. the port b data register is located at address $0001 and its data direction register (ddr) is located at address $0005. reset does not affect the data registers, but clears the ddrs, thereby setting all of the port pins to input mode. writing a one to a ddr bit sets the corresponding port pin to output mode. pb7 features a larger n-channel output device and can therefore sink more current than a standard port. (refer to section 12: electrical specifications .) pb4-pb5 may be used for general i/o applications when the sci subsystem is disabled. when the sci subsystem is enabled, port b registers are still accessible to software. pa7 v ss line l n r mcu
MC68HC705MC4 specification rev. 1.5 section 6: input/output ports motorola page 35 writing to either of the port b registers could corrupt the sci data. see section 10: serial communications interface for a discussion of the sci subsystem. figure 6-3: port b i/o circuitry 6.3 port c port c is an 8-bit bidirectional port that has shared pins with the a/d subsystem. the port c data register is located at address $0002 and its data direction register (ddr) is located at address $0006. reset does not affect the data registers, but clears the ddrs, thereby setting all of the port pins to input mode. writing a one to a ddr bit sets the corresponding port pin to output mode. (see figure 6-4: port c i/o circuitry .) the adon bit in register adsc is used to enable/disable the a/d subsystem. port c may be used for general i/o applications when the a/d subsystem is disabled or when all a/d input channels are not required. unselected channels revert to general purpose i/o. see section 7: analog subsystem . figure 6-4: port c i/o circuitry read $0001 write $0001 read $0005 data register bit i/o pin output internal hc05 data bus reset (rst) write $0005 data direction register bit read $0002 write $0002 read $0006 data register bit i/o pin output internal hc05 data bus reset (rst) write $0006 data direction register bit
MC68HC705MC4 specification rev. 1.5 motorola section 6: input/output ports page 36 6.4 port d port d is a 2-bit port. pd7 and pd6 are shared with the 16-bit timer. pd6 is a bi-directional i/o pin but pd7 is an input only pin. the port d data register is located at address $0003 and its data direction register (ddr) is located at address $0007. reset clears the ddr setting pd6 to an input but does not affect the data registers. pd6 may be used for general i/o applications when the sci subsystem is disabled. pd7 may be used as a general purpose input when the sci subsystem is disabled. when the sci subsystem is enabled, port d registers are still accessible to software. writing to either of the port d registers with the timer enabled could interfere with timer operation. see section 8: 16-bit timer for a discussion of the timer subsystem. figure 6-5: port d circuitry 6.5 i/o port programming each pin on ports a-c may be programmed as an input or an output under software control as shown in table 6-1: port a i/o pin functions , table 6-2: port b i/o pin functions , table 6-3: port c i/o pin functions , and table 6-4: port d i/o pin functions . the direction of a pin is determined by the state of its corresponding bit in the associated port data direction register (ddr). a pin is configured as an output if its corresponding ddr bit is set to a logic one. a pin is configured as an input if its corresponding ddr bit is cleared to a logic zero. at power-on or reset, all ddrs are cleared, which configures all port pins as inputs. the ddrs are capable of being written to or read by the processor. during the programmed output state, a read of the data register will actually read the value of the output data latch and not the level on the i/o port pin. read $0003 tcmp read $0007 data register bit i/o pin output internal hc05 data bus reset (rst) tcmp/tcap1 data direction register bit
MC68HC705MC4 specification rev. 1.5 section 6: input/output ports motorola page 37 table 6-1: port a i/o pin functions table 6-2: port b i/o pin functions table 6-3: port c i/o pin functions table 6-4: port d i/o pin functions note: to avoid generating a glitch on an i/o port pin, data should be written to the i/o port data register before writing a logical one to the corresponding data direction register. accesses to data register @ $0000 0 1 in, hi-z out ddra0-7 ddra0-7 pa0-7 pa0-7 * pa0-7 i/o pin mode ddra read/write accesses to ddra @ $0004 read write * does not affect input, but stored to data register accesses to data register @ $0001 0 1 in, hi-z out ddrb4-7 ddrb4-7 pb4-7 pb4-7 * pb4-7 i/o pin mode ddrb read/write accesses to ddrb @ $0005 read write * does not affect input, but stored to data register accesses to data register @ $0002 0 1 in, hi-z out ddrc0-7 ddrc0-7 pc0-7 pc0-7 * pc0-7 i/o pin mode ddrc read/write accesses to ddrc @ $0006 read write * does not affect input, but stored to data register accesses to data register @ $0003 0 1 in, hi-z out ddrd6 ddrd6 pd6-7 pd6 * pd6 i/o pin mode ddrd read/write accesses to ddrd @ $0007 read write * does not affect input, but stored to data register
MC68HC705MC4 specification rev. 1.5 motorola section 6: input/output ports page 38 this page intentionally left blank
MC68HC705MC4 specification rev. 1.5 section 7: analog subsystem motorola page 39 section 7 analog subsystem the MC68HC705MC4 includes a 6-channel, 8-bit, multiplexed input, successive approximation a/d converter, with six of the inputs available on external pins and four additional internal channels. 7.1 analog section 7.1.1 ratiometric conversion the a/d is ratiometric, with two dedicated pins supplying the reference voltages (v refh and v refl ). an input voltage equal to v refh converts to $ff (full scale) and an input voltage equal to v refl converts to $00. an input voltage greater than v refh will convert to $ff with no overflow indication. for ratiometric conversions, the source of each analog input should use v refh as the supply voltage and be referenced to v refl . 7.1.2 v refh and v refl the reference supply for the converter uses two dedicated pins rather than being driven by the system power supply lines because the voltage drops in the bonding wires of those heavily loaded pins would degrade the accuracy of the a/d conversion. v refh and v refl are internally wired to the analog supply voltages av dd and av ss . these pins are located next to each other to permit optimal decoupling. 7.1.3 accuracy and precision the 8-bit conversions shall be accurate to within 1 1 / 2 lsb including quantization. 7.2 conversion process the a/d reference inputs are applied to a precision internal digital-to-analog converter. control logic drives this d/a and the analog output is successively compared to the selected analog input that was sampled at the beginning of the conversion time. the conversion process is monotonic and has no missing codes. 7.3 digital section 7.3.1 conversion times each channel of conversion takes 32 clock cycles, which must be at a frequency equal to or greater than 1 mhz.
MC68HC705MC4 specification rev. 1.5 motorola section 7: analog subsystem page 40 7.3.2 multi-channel operation in user mode, a multiplexer allows the single a/d converter to select one of eight analog signals, two of which are v refh and v refl . the eight pins of port c are input signals to the multiplexer. 7.3.3 unused a/d inputs as i/o when the a/d system is enabled, two pins, v refh (pc6) and v refl (pc7), are automatically assumed to have their dedicated functions. the channel select bits define which port c pin will be used as the analog in pin and overrides any control from the port c i/o logic by forcing that pin as the input to the analog circuitry. the port c pins that are not selected by the channel select bits, [ch3:0], are controlled by the port c i/o logic, and thus can be used as general purpose i/o. writes to port c will not have any effect on the selected channel. note: the ddr bits corresponding to an a/d channel used by the application must be cleared. for example, ad2 shares a pin with pc2, so the ddrc2 bit must be cleared (unless this is the only channel the a/d ever selects). this is to ensure that the port output value held in the port c data register is not driven out of the pin when the a/d has selected another channel for conversion. 7.4 a/d status and control register (adscr) $25 the following paragraphs describe the function of the a/d status and control register. figure 7-1: a/d status and control register 7.4.1 coco - conversions complete this read-only status bit is set when a conversion is completed, indicating that the a/d data register contains valid results. this bit is cleared whenever the a/d status and control register is written and a new conversion is automatically started, or whenever the a/d data register is read. once a conversion has been started by writing to the a/d status and control register, conversions of the selected channel will continue every 32 cycles until the a/d status and control register is written again. in this continuous conversion mode, the a/d data register will be filled with new data, and the coco bit set, every 32 cycles. data from the previous conversion will be overwritten regardless of the state of the coco bit prior to writing. ch1 ch3 adon adrc ch2 ch0 adsr $0025 7 w r 6543210 coco 00000000 reset t 0
MC68HC705MC4 specification rev. 1.5 section 7: analog subsystem motorola page 41 7.4.2 adrc - a/d rc oscillator control when the rc oscillator is selected (adrc = 1) to be the a/d clock source, it requires a time t adrc to stabilize. results can be inaccurate during this time. if the cpu clock is running below 1 mhz, the rc oscillator must be used. when adrc=0, the a/d uses the cpu clock. 7.4.3 adon - a/d on when the a/d is turned on (adon = 1), it requires a time t adon for the current sources to stabilize, and results can be inaccurate during this time. this bit turns on the charge pump. if the adrc is set, clearing this bit disables the rc oscillator to save power. 7.4.4 ch3:ch0 - channel select bits ch3, ch2, ch1, and ch0 form a 4-bit field, which is used to select one of eight a/d channels. channels 0-5 correspond to port c input pins on the mcu. channels 8-a are used for internal reference points. in user mode, channel b is reserved and converts to $00. the following table shows the signals selected by the channel select field. using a port c pin as both an analog and digital input simultaneously is prohibited to prevent excess power dissipation. when the a/d is enabled (adon = 1) and one of the channels 0-5 is selected, the corresponding port c pin will appear as a logic zero to a digital read. the remaining port c pins (0-5) will read normally. to digitally read all eight port c pins simultaneously, the a/d must be disabled (adon = 0).
MC68HC705MC4 specification rev. 1.5 motorola section 7: analog subsystem page 42 table 7-1: a/d channel assignments 7.5 a/d data register ($24) one 8-bit result register is provided. this register is updated each time coco is set. reset has no effect on this register. figure 7-2: a/d data register 7.6 a/d during wait mode the a/d continues normal operation during wait mode. to decrease power consumption during wait, it is recommended that both the adon and adrc bits in the a/d status and control register be cleared if the a/d converter is not being used. if the a/d converter is in use and the system clock rate is above 1.0 mhz, it is recommended that the adrc bit be cleared. 7.7 a/d during stop mode in stop mode, the comparator and charge pump are turned off and the a/d ceases to function. any pending conversion is aborted. when the clocks begin oscillation upon leaving the stop mode, a finite amount of time passes before the a/d circuits stabilize enough to provide conversions to the specified accuracy. normally, the delays built into the MC68HC705MC4 when coming out of stop mode are sufficient for this purpose, therefore no explicit delays need to be built into the software. 3 ad3 port c bit 3 channel signal 0 ad0 port c bit 0 1 ad1 port c bit 1 2 ad2 port c bit 2 8v refh 9v refl 7 unused 4 ad4 port c bit 4 5 ad5 port c bit 5 6 unused a(v refh + v refl )/2 b-f v refl ad7 ad5 ad4 ad3 ad2 ad1 ad0 ad6 $24 addr
MC68HC705MC4 specification rev. 1.5 section 8: 16-bit timer motorola page 43 section 8 16-bit timer the MC68HC705MC4 mcu contains a single 16-bit programmable timer with two input capture functions and an output compare function. the 16-bit timer is driven by the output of a fixed divide-by-four prescaler operating from the internal clock. the 16-bit timer may be used for many applications including input waveform measurement while simultaneously generating an output waveform. pulse widths can vary from microseconds to seconds depending on the oscillator frequency selected. the 16-bit timer is also capable of generating periodic interrupts. see figure 8-1: 16-bit timer block diagram . because the timer has a 16-bit architecture, each function is represented by two registers. each register pair contains the high and low byte of that function. generally, accessing the low byte of a specific timer function allows full control of that function; however, an access of the high byte inhibits that specific timer function until the low byte is also accessed. note: the i-bit in the condition code register (ccr) should be set while manipulating both the high and low byte registers of a specific timer function. this prevents interrupts from occurring between the time that the high and low bytes are accessed. 8.1 timer the key element of the programmable timer is a 16-bit free-running counter, or timer registers, preceded by a prescaler which divides the internal clock by four. the prescaler gives the timer a resolution of 1.33 microseconds when a 3 mhz crystal is used. the counter is incremented to increasing values during the low portion of the internal clock cycle. the double byte free-running counter can be read from either of two locations: the timer registers (tmrh, tmrl) or the alternate counter registers (acrh, acrl). both locations will contain identical values. a read sequence containing only a read of the lsb of the counter (tmrl / acrl) will return the count value at the time of the read. if a read of the counter accesses the msb first (tmrh / acrh) it causes the lsb (tmrl / acrl) to be transferred to a buffer. this buffer value remains fixed after the first msb byte read even if the msb is read several times. the buffer is accessed when reading the counter lsb (tmrl / acrl), and thus completes a read sequence of the total counter value. when reading either the timer or alternate counter registers, if the msb is read, the lsb must also be read to complete the read sequence. see figure 8-2: timer registers (tmrh / tmrl) and figure 8-3: alternate counter registers (acrh / acrl) .
MC68HC705MC4 specification rev. 1.5 motorola section 8: 16-bit timer page 44 figure 8-1: 16-bit timer block diagram icie1 tc- mp/tc edge detector compare detector over?ow detector internal clock free-running counter internal hc05 bus timer status register output compare ocrh ocrl input capture 2 icrh2 icrl2 ocf tcap2 ? 4 buffer tmrh/ acrh tm- rl/ac tof icf1 toie ocie olvl iedg2 timer control register interrupt generator r tcmp d > q reset timer interrupt input capture 1 icrh1 icrl1 iedg1 edge detector tcap1 icie2 shared icf2 port
MC68HC705MC4 specification rev. 1.5 section 8: 16-bit timer motorola page 45 figure 8-2: timer registers (tmrh / tmrl) figure 8-3: alternate counter registers (acrh / acrl) the timer registers and alternate counter registers can be read at any time without affecting their values. however, the alternate counter registers differ from the timer registers in one respect: a read of the timer register lsb can clear the timer overflow flag (tof). therefore, the alternate counter registers can be read at any time without the possibility of missing timer overflow interrupts due to clearing of the tof. see figure 8-4: state timing diagram for timer overflow . figure 8-4: state timing diagram for timer overflow the free-running counter is initialized to $fffc during reset and is a read-only register. tmrh7 tmrh $0020 1 7 w r 1111111 reset t 6543210 tmrh0 tmrh2 tmrh1 tmrh3 tmrh4 tmrh5 tmrh6 tmrl $0021 1 7 w r 1111100 reset t 6543210 tmrl0 tmrl2 tmrl1 tmrl3 tmrl4 tmrl5 tmrl6 tmrl7 acrh $0022 1 7 w r 1111111 reset t 6543210 acrh0 acrh2 acrh1 acrh3 acrh4 acrh5 acrh6 acrh7 acrl $0023 1 7 w r 1111100 reset t 6543210 acrl0 acrl2 acrl1 acrl3 acrl4 acrl5 acrl6 acrl7 $fffe $ffff $0000 $0001 $0002 16-bit free-runni ng counter timer over?ow flag (tof) internal clock note: the tof bit is set at timer state t11 (transition of counter from $ffff to $0000). it is cleared by reading the timer status register (tsr) during the high portion of the internal clock followed by reading the lsb of the counter register pair (tmrl).
MC68HC705MC4 specification rev. 1.5 motorola section 8: 16-bit timer page 46 8.2 output compare the output compare function may be used to generate an output waveform and/or as an elapsed time indicator. if the tcmp/tcap1 bit of the tcr is set, output to the port pin is enabled. all of the bits in the output compare register pair ocrh / ocrl are readable and writable and are not altered by the 16-bit timers control logic. reset does not affect the contents of these registers. see figure 8-5: output compare registers (ocrh / ocrl) . figure 8-5: output compare registers (ocrh / ocrl) the contents of the output compare registers are compared with the contents of the free-running counter once every four internal clock cycles. if a match is found, the output compare flag bit (ocf) is set and the output level bit (olvl) is clocked to the output latch. the values in the output compare registers and output level bit should be changed after each successful comparison to control an output waveform, or to establish a new elapsed time-out. an interrupt can also accompany a successful output compare if the output compare interrupt enable bit (ocie) is set. after a cpu write cycle to the msb of the output compare register pair (ocrh), the output compare function is inhibited until the lsb (ocrl) is written. both bytes must be written if the msb is written. a write made only to the lsb will not inhibit the compare function. the free-running counter increments every four internal clock cycles. the minimum time required to update the output compare registers is a function of software rather than hardware. the output compare output level bit (olvl) will be clocked to its output latch regardless of the state of the output compare flag bit (ocf). a valid output compare must occur before the olvl bit is clocked to its output latch (tcmp). note: the tcmp/tcap1 bit of the tcr only affects the output of the latch to the port pin and has no effect on other parts of the output compare function. since neither the output compare flag (ocf) nor the output compare registers are affected by reset, care must be exercised when initializing the output compare function. the following procedure is recommended: 1. block interrupts by setting the i-bit in the condition code register (ccr). ocrh7 7 ocrh6 w r 6543210 ocrh5 ocrh4 ocrh3 ocrh2 ocrh1 ocrh0 ocrh $001d ocrl7 x ocrl6 w r xxxxxxx ocrl5 ocrl4 ocrl3 ocrl2 ocrl1 ocrl0 ocrl $001e reset t
MC68HC705MC4 specification rev. 1.5 section 8: 16-bit timer motorola page 47 2. write the msb of the output compare register pair (ocrh) to inhibit further compares until the lsb is written. 3. read the timer status register (tsr) to arm the output compare flag (ocf). 4. write the lsb of the output compare register pair (ocrl) to enable the output compare function and to clear its flag ocf (and interrupt). 5. unblock interrupts by clearing the i-bit in the ccr. this procedure prevents the output compare flag bit (ocf) from being set between the time it is read and the time the output compare registers are updated. a software example is shown in figure 8-6: output compare software initialization example . figure 8-6: output compare software initialization example figure 8-7: state timing diagram for output compare 9b . . b6 be b7 b6 bf . . 9a . . xx xx 16 13 17 . . sei . . lda ldx sta lda stx . . cli . . datah datal ocrh tsr ocrl . . block interrupts . . hi byte for compare lo byte for compare inhibit output compare arm ocf bit to clear ready for next compare . . unblock interrupts notes: 1. the cpu write to the compare register may take place at any time, but a compare occurs only at timer state t01. thus, up to a four cycle difference may exist between the write to the compare register and the actual compare. 2. internal compare takes place during timer state t01. 3. the output compare flag bit (ocf) is set at timer state t11, which follows the comparison match ($0fed in this example). output compare flag and output pin 16-bit free-running counter compare register compare register latch internal clock $0feb $0fec $0fed $0fee $0fef cpu writes $0fed $0fed (note 1) (note 2) (note 3)
MC68HC705MC4 specification rev. 1.5 motorola section 8: 16-bit timer page 48 8.3 input captures registers are used to latch the value of the free-running counter after a defined transition is sensed by the input capture edge detector ( note: the input capture edge detector contains a schmitt trigger to improve noise immunity.) the edge that triggers the counter transfer is defined by each input edge bit (iedg1, iedg2) in register tcr. dynamically changing from capture to compare function will not affect the contents of the registers. all of the bits in the input capture register pair icrh / icrl are readable and are not altered by the 16-bit timers control logic. writes have no effect. reset does not affect the contents of these registers. see figure 8-8: input capture registers (icrh1 / icrl1) and figure 8-9: input capture registers (icrh2 / icrl2) . figure 8-8: input capture registers (icrh1 / icrl1) figure 8-9: input capture registers (icrh2 / icrl2) the result obtained by an input capture will be one more than the value of the free-running counter on the rising edge of the internal clock preceding the external transition (see figure 8-10: state timing diagram for input capture ). this delay is required for internal synchronization. resolution is affected by the prescaler, allowing the free-running counter to increment once every four internal clock cycles. the contents of the free-running counter are transferred to the input capture registers on each proper signal transition regardless of the state of the respective input capture flag bit (icf1, icf2) in register tsr, the respective flag will be set. the input capture registers always contain the free-running counter value, which corresponds to the most recent input capture. an interrupt can also accompany a successful input capture if the respective input capture interrupt enable bit (icie) is set. icrh1 $001b x 7 w r xxxxxxx reset t 6543210 icrh0 icrh2 icrh1 icrh3 icrh4 icrh5 icrh6 icrh7 icrl1 $001c w r icrl0 icrl2 icrl1 icrl3 icrl4 icrl5 icrl6 icrl7 icrh2 $0019 x 7 w r xxxxxxx reset t 6543210 icrh0 icrh2 icrh1 icrh3 icrh4 icrh5 icrh6 icrh7 icrl2 $001a w r icrl0 icrl2 icrl1 icrl3 icrl4 icrl5 icrl6 icrl7
MC68HC705MC4 specification rev. 1.5 section 8: 16-bit timer motorola page 49 when the tcmp/tcap1 bit of tcr is set, input capture function for tcap1 is inhibited. after a read of the msb of the input capture register pair (icrh1, icrh2), counter transfers are inhibited until the respective lsb of the register pair (icrl1, icrl2) is also read. this characteristic forces the minimum pulse period attainable to be determined by the time required to execute an input capture software routine in an application. reading the lsb of the input capture register pair (icrl1, icrl2) does not inhibit transfer of the free-running counter. again, minimum pulse periods are ones that allow software to read the lsb of the register pair (icrl1, icrl2) and perform needed operations. there is no conflict between reading the lsb (icrl1, icrl2) and the free-running counter transfer since they occur on opposite edges of the internal clock. figure 8-10: state timing diagram for input capture 8.4 timer control register (tcr) the timer control (tcr) and free-running counter (tmrh, tmrl, acrh, acrl) registers are the only registers of the 16-bit timer affected by reset. the output compare port (tcmp) is forced low after reset and remains low until olvl is set and a valid output compare occurs. figure 8-11: timer control register (tcr) input capture flag input capture register 16-bit free-running counter tcap pin input capture latch internal clock note: if the input edge occurs in the shaded area from one t10 timer state to the other t10 timer state, the input capture ?ag is set during the next t11 timer state. $0fec $0fed $0fee $0fef $0feb previous capture value $0fed (see note) icie2 0 7 icie1 w r 0000xx0 6543210 toie olvl iedg2 tcr $0017 reset t iedg1 ocie tcmp /tcap1
MC68HC705MC4 specification rev. 1.5 motorola section 8: 16-bit timer page 50 8.4.1 icie2 - input capture interrupt enable 2 bit 7, when set, enables input capture 2 interrupts to the cpu. the interrupt will occur at the same time bit 7 (icf2) in the tsr register is set. 8.4.2 icie1 - input capture interrupt enable 1 bit 6, when set, enables input capture 1 interrupts to the cpu. the interrupt will occur at the same time bit 6 (icf1) in the tsr register is set. 8.4.3 toie - timer overflow interrupt enable bit 5, when set, enables timer overflow (rollover) interrupts to the cpu. the interrupt will occur at the same time bit 5 (tof) in the tsr register is set. 8.4.4 ocie - output compare interrupt enable bit 4, when set, enables output compare interrupts to the cpu. the interrupt will occur at the same time bit 4 (ocf) in the tsr register is set. 8.4.5 tcmp/tcap1 bit 3, when set, enables the tcmp function, when clear, the tcap1 function. reset clears this bit. when set it enables the tcmp output latch value to be output to the port pin and disables the edge detect of tcap1. when clear, it disables the tcmp output latch from the port pin and enables the edge detect of tcap1. note that this bit has no effect on the setting of ocf and icf1. 8.4.6 iedg1 - input capture edge select 1 bit 2 selects which edge of the input capture signal will trigger a transfer of the contents of the free-running counter registers to the input capture registers (icrh1, icrl1). clearing this bit will select the falling edge, setting it selects the rising edge. 8.4.7 iedg2 - input capture edge select 2 bit 1 selects which edge of the input capture signal will trigger a transfer of the contents of the free-running counter registers to the input capture registers (icrh2, icrl2). clearing this bit will select the falling edge, setting it selects the rising edge. 8.4.8 olvl - output compare output level select bit 0 selects the output level (high or low) that is clocked into the output compare output latch at the next successful output compare. 8.5 timer status register (tsr) reading the timer status register (tsr) satisfies the first condition required to clear status flags and interrupts. the only remaining step is to read (or write) the register associated with the active status flag (and/or interrupt). this method does not present any problems for input capture or output compare functions.
MC68HC705MC4 specification rev. 1.5 section 8: 16-bit timer motorola page 51 however, a problem can occur when using a timer interrupt function and reading the free-running counter at random times to, for example, measure an elapsed time. if the proper precautions are not designed into the application software, a timer interrupt flag (tof) could unintentionally be cleared if: 1. the tsr is read when bit 5 (tof) is set, and 2. the lsb of the free-running counter is read, but not for the purpose of servicing the flag or interrupt. the alternate counter registers (acrh, acrl) contain the same values as the timer registers (tmrh, tmrl). registers acrh and acrl can be read at any time without affecting the timer overflow flag (tof) or interrupt. figure 8-12: timer status register (tsr) 8.5.1 icf2 - input capture 2 flag bit 7 is set when the edge specified by iedg2 in register tcr has been sensed by the input capture edge detector fed by pin tcap2. this flag, and the input capture interrupt, can be cleared by reading register tsr followed by reading the lsb of the input capture register pair (icrl2). 8.5.2 icf1 - input capture 1 flag bit 6 is set when the edge specified by iedg1 in register tcr has been sensed by the input capture edge detector fed by pin tcap1. this flag, and the input capture interrupt, can be cleared by reading register tsr followed by reading the lsb of the input capture register pair (icrl1). 8.5.3 tof - timer overflow flag bit 5 is set by a rollover of the free-running counter from $ffff to $0000. this flag, and the timer overflow interrupt, can be cleared by reading register tsr followed by reading the lsb of the timer register pair (tmrl). 8.5.4 ocf - output compare flag bit 4 is set when the contents of the output compare registers match the contents of the free-running counter. this flag, and the output compare interrupt, can be cleared by reading register tsr followed by writing the lsb of the output compare register pair (ocrl). x 7 w r xxx0000 6543210 0 0 0 0 ocf tsr $0018 reset t tof icf1 icf2
MC68HC705MC4 specification rev. 1.5 motorola section 8: 16-bit timer page 52 8.6 timer operation during wait/halt modes during wait modes, the 16-bit timer continues to operate normally and may generate an interrupt to trigger the mcu out of the wait mode. 8.7 timer operation during stop mode when the mcu enters the stop mode, the free-running counter stops counting (the internal clock is stopped). it remains at that particular count value until the stop mode is exited by applying an active signal to the irq pin, at which time the counter resumes from its stopped value as if nothing had happened. if stop mode is exited via an external reset (logic low applied to the reset pin) the counter is forced to $fffc. if a valid input capture edge occurs at either of the tcap pins during stop mode, the input capture detect circuitry will be armed. this action does not set any flags or wake up the mcu, but when the mcu does wake up there will be an active input capture flag (and data) from the first valid edge. if the stop mode is exited by an external reset, no input capture flag or data will be present even if a valid input capture edge was detected during the stop mode.
MC68HC705MC4 specification rev. 1.5 section 9: pulse width modulator motorola page 53 section 9 pulse width modulator the pulse width modulator (pwm) subsystem has two 8-bit channels (pwma and pwmb). the pwm has a programmable prescaler, divide by 1.5 added to the initial prescaler, polarity, and mux enable with channel masking for motor control applications. the pwm is capable of generating signals from 0% to 100% duty cycle. a $00 in either pwm data register yields an off output (0%) with the polarity control bit set to one for that channel (i.e. pwma or pwmb), but a $ff yields a duty of 255/256. to achieve the 100% duty (on output), the polarity control bit is set to zero for that channel (i.e. pwma or pwmb) while the data register has $00. . figure 9-1: pwm block diagram modulus & comparator b modulus & comparator a buffer 8-bit counter pwm control register b hc05 data bus pwm control register a mea 8-bit counter osc1 ra[2:0] ra[3] mea || csa3 || csa2 || csa1 rb[2:0] rb[3] meb || csb3 || csb2 || csb1 pwm data a buffer pwm data b to enable to enable csa[3:1] mska[2:0] pa1 pa3 pa5 mux & logic meb csb[3:1] mskb[2:0] clock generator ? 1.5 circuit (6 mhz) ? 1.5 circuit port pa2 pa4 pa6 mux & logic port
MC68HC705MC4 specification rev. 1.5 motorola section 9: pulse width modulator page 54 9.1 pwm registers figure 9-2: pwm ctl registers figure 9-3: pwma & pwmb data registers the pwm subsystem control and data registers are all buffered, as shown in figure 9-10: pwm register structure . each register consists of an active register, which contains the data used by the pwm subsystem, and a buffer register, which contains the data most recently written to the register address. writes to the buffer registers are transferred to the active registers at the end of the pwm period if the respective bit in the update register is set to zero. if it is set to one, the transfer will occur immediately. in addition, a predefined sequence of register accesses may also need to be completed before the new contents meb polb w r mskb3 mskb2 mskb1 csb3 csb2 csb1 ctl-b $0015 mea pola w r mska3 mska2 mska1 csa3 csa2 csa1 ctl-a $0014 ra3 0 ra2 w r 00 0000 ra1 ra0 rb3 rb2 rb1 rb0 rate $0016 reset t updatea updateb w r update $0027 0 pwma7 pwma6 w r pwma5 pwma4 pwma3 pwma2 pwma1 pwma0 pwma-d $0010 pwmb7 pwmb6 w r pwmb5 pwmb4 pwmb3 pwmb2 pwmb1 pwmb0 pwmb-d $0012 x xxxxxx x reset t pwmb7 pwmb6 w r pwmb5 pwmb4 pwmb3 pwmb2 pwmb1 pwmb0 pwmb-i $0013 pwma7 pwma6 w r pwma5 pwma4 pwma3 pwma2 pwma1 pwma0 pwma-i $0011
MC68HC705MC4 specification rev. 1.5 section 9: pulse width modulator motorola page 55 of these registers are transferred. this sequence of accesses is referred to as a register interlock mechanism, and is intended to allow more than one register to be modified before effecting the pwm operation. the data register interlock mechanism is managed by mapped each data register to an interlock address (pwmx-i) and a direct address (pwmx-d). writes to the interlock address will engage the interlock mechanism. writes to the direct address will not engage the interlock mechanism unless they are already engaged prior to the write. 9.2 pwm control bits the pwm subsystem is controlled through three control registers: ctl-a, ctl-b, rate, and update. ctl-a, ctl-b, and the data registers feature a write interlock and buffer mechanism to permit their contents to be updated simultaneously, preventing undesirable glitching of the associated port a i/o. the rate register selects the pwm counter input clock rate, defining the pwm period. this register is buffered but not interlocked with other registers, so writes to this register will become effective at the end of the current pwm period (if the update bit has been cleared), irrespective of the state of any interlock mechanism. 9.2.1 polx - polarity initializes pwm output. toggles at match point to data register. see figure 9-4: pwm waveforms (polx = 1) and figure 9-5: pwm waveforms (polx = 0) . 1 = initialize output to one. toggles to zero at data match. 0 = initialize output to zero. toggles to one at data match. figure 9-4: pwm waveforms (polx = 1) 50 ff 80 pwm register = $00 t
MC68HC705MC4 specification rev. 1.5 motorola section 9: pulse width modulator page 56 figure 9-5: pwm waveforms (polx = 0) 9.2.2 rx[3:0] - pwm output rate select selects input clock for the 8-bit pwm counter. 50 80 pwm register = $00 t ff
MC68HC705MC4 specification rev. 1.5 section 9: pulse width modulator motorola page 57 table 9-1: pwm rate select table 9.2.3 csx[3:1] - channel select selects which channel/s will receive the pwm waveform output. when csx[y] is set, the channel is selected and the pwmx output waveform will be sent to the port logic. when csx[y] is clear, the output will depend on the mex bit and the corresponding port register bit. see description for mex. 9.2.4 mex - mask enable when set, mex enables the output mask feature of the pwmx subsystem. when enabled, all three channels will be used for subsystem output, that is the port registers will have no effect. all unselected channels (channels that have their corresponding csx bit clear) will output the corresponding value of the mskx bit. all selected channels (channels that have their corresponding csx bit set) will output the pwm waveform. when mex is clear, output mask feature is disabled and the port will function as a normal i/o port if the csx bit is cleared. this feature allows some of the ports to be freed up for normal i/o when not used for pwm output. if the corresponding csx bit is set, the rx[3:0] pwm output cycle 0 23.4 khz 1 11.7 khz 2 5.86 khz 3 2.93 khz 4 1.46 khz 5 732 hz 6 366 hz 7 183 hz 8 15.6 khz 9 7.8 khz a 3.9 khz b 1.95 khz c 975 hz d 488 hz e 244 hz f 122 hz
MC68HC705MC4 specification rev. 1.5 motorola section 9: pulse width modulator page 58 selected channel will output the pwm waveform. see figure 9-6: pwm output mux logic and figure 9-7: pwm control example . if mex is clear and all csx bits are clear, it also disables the corresponding 8-bit counter to save power. if both counters are disabled, the clock generator will also be disabled. figure 9-6: pwm output mux logic 9.2.5 mskx[3:1] - mask set mask values for channels that are not selected by csx when mex is set. a mask value of 1 drives unselected mux-pins high. a mask value of 0 drives unselected mux-pins low. when mex is clear, the mask bits have no effect. if the mask feature is enabled (mex =1), the mask bits also provide an alternative method of generating 0% or 100% values. the conventional method generates 100% duty cycle by inverting the output polarity and simultaneously clearing the pwm data bits. see figure 9-6: pwm output mux logic and figure 9-7: pwm control example . 9.2.6 updatex the updatea and updateb bits control when the registers for pwm a and pwm b will be updated. if the corresponding bit is clear, the registers will be updated at the end of the current cycle. if the corresponding bit is set, the registers will be updated immediately. the normal interlock restrictions still apply. me . cs . ddr me . cs port data register port output logic cs pwm output msk
MC68HC705MC4 specification rev. 1.5 section 9: pulse width modulator motorola page 59 figure 9-7: pwm control example 9.3 pwm data bits the pulse width of the pwm waveform is controlled by the two data registers pwma and pwmb. each data register can be accessed from one of two locations, pwmx-d (direct) and pwmx-i (interlock). a write interlock and buffer mechanism is used to permit their contents to be updated simultaneously, preventing undesirable glitching of the associated port a i/o. see 9.5.1: pwm data register . 9.4 pwm during resets the pwm subsystem has two types of resets. one is a hardware reset denoted by reset. the other is a pwm reset denoted by preset. after a reset, the user should write to the data registers, rate, ctl-b, then ctl-a. this will avoid an erroneous duty cycle from being driven on any of the selected pwm port pins. a preset condition is reached by clearing the meb bit and the csb[3:1] bits in ctl-b, then the mea bit and the csa[3:1] bits in ctl-a. this disables the pwm subsystem, resets the 8-bit counters, resets the clock generator, and sets the port pins to the state defined by the respective port data registers and data direction registers. the data registers are unaffected by reset. the ctl registers are cleared by reset. a preset does not affect any of the pwm registers. 9.5 pwm operation in user mode all pwm registers are buffered. the register buffering prevents data written to either the control or data registers from affecting the pwm cycle underway at the time of the data pwm output port pwm output logic one pwm output port pwm output pwm output logic one logic zero port port logic zero pwm output pwm output 001 010 011 100 101 cs[3:1] me msk[3:1] pwm1 pwm2 pwm3 xxx xxx 0xx x11 x0x x = dont care
MC68HC705MC4 specification rev. 1.5 motorola section 9: pulse width modulator page 60 write. the interlock mechanism extends this principle to multiple registers by preventing data written to groups of data and/or control registers from affecting the pwm configuration currently active until all writes are complete. there are several interlock options from which the user can pick depending upon the change of function desired. the register interlock mechanism operation is shown diagrammatically in figure 9-8: pwm interlock mechanisms . figure 9-8: pwm interlock mechanisms ra = rb ra = rb pwmx-d pwmb-i pwmb-d pwma-d pwmb-i pwma-x ctl-b ctl-a pwma-i ctl-a ctl-b ctl-a ctl-x ctl-b pwma-i ctl-a = interlocks satisfied; active registers will be updated at the end of the current pwm cycle x = dont care
MC68HC705MC4 specification rev. 1.5 section 9: pulse width modulator motorola page 61 9.5.1 pwm data register the pwma and pwmb data registers have been mapped to two different addresses: the direct address and the interlock address. the pwma-d direct address is $10 and the pwma-i interlock address is $11. the pwmb-d direct address is $12 and the pwmb-i interlock address is $13. a read from either the direct or the interlock address will read the pwm active register. a write to either address will write to the pwm buffer register. writing to a pwmx interlock address will activate a data - control interlock mechanism with the corresponding ctl-x register. under such a condition, the new value written to the pwm interlock data register will not be effective until the end of the current pwm cycle during which a read or write of the corresponding control register was executed. a typical application for such a mechanism is to generate 100% duty cycle when not using the pwm output mask feature (mex =0). synchronized changes to both data and control registers are therefore necessary to avoid pwm glitches. 100% duty cycle can be generated by clearing pwmx-i, then toggling the state of the polx bit in the corresponding ctl-x register. any new data written to either register will become effective at the end of the current pwm cycle during which the write or read to ctl-x took place. writing to the direct address will not activate the interlock mechanism with the control register. the new value will be updated at the end of the current pwm cycle if the update bit is clear. the new value will be updated immediately if the update bit is set.. note: in either case above (write to interlock or direct addresses), the interlock mechanism that interlocks channel a and channel b together may preempt the transfer of the new data to the active registers. see 9.5.3: operation with the same pwm rates for more detail. 9.5.2 operation with different pwm rates if ra does not equal rb, channel a and channel b are assumed to be operating independently of each other and are not interlocked. new data values written to either pwm channel will occur as discussed in 9.5.1: pwm data register . interlocking between the channels only applies when both channels have the same period (ra = rb). the rate register is not interlocked with any other registers but it is buffered. changes to this register will affect the pwm cycle subsequent to the write. consequently, changing the pwm period while generating a pwm signal will not cause erroneous pwm operation (i.e., glitches). note that the rate register is treated as two separate 4-bit registers, each buffered with the corresponding pwm channel cycle. note: changing the channels from having different periods to having the same period may cause a phase difference between the channels due to accumulated clock phase difference. if synchronization is needed between channel a and channel b, a preset cycle must be executed to provide correct operation of the channel a/b interlock mechanism.
MC68HC705MC4 specification rev. 1.5 motorola section 9: pulse width modulator page 62 9.5.3 operation with the same pwm rates if ra equals rb, channel a and channel b are assumed to be operating together in a synchronous fashion and are interlocked. this interlock mechanism described below is in addition to the buffering and the pwm data - control interlock described in 9.5.1: pwm data register . a write to either pwmb data register must be followed by a write or a read to either pwma data register. any new data written will become effective at the end of the current pwm cycle during which the write or read to pwma took place as shown in figure 9-8: pwm interlock mechanisms . the interlocking between the data registers is disabled when the channels have different periods. a write to ctlb control register must be followed by a write to the ctla control register. any new data written to either register will become effective at the end of the current pwm cycle during which the write to ctla took place. the interlocking between the control registers is disabled when the channels have different periods. writing to the pwmx interlock address will also activate the interlock mechanism with the ctl-x register as described in 9.5.1: pwm data register . the two interlocking mechanisms, channel a - channel b and data - control, may be in effect at the same time. example 1: writing to pwmb-i ($13) will require a write to ctl-b ($15) to satisfy the data - control interlock. in addition, if ra=rb, the write to either pwmb data register will require a read/write to either pwma data register, and the write to ctl-b control register, will require a write to ctl-a register in order to satisfy the channel a - channel b interlock. the new contents of all these register will be transferred into their respective active registers at the end of the current pwm cycle during which all invoked interlock mechanisms become satisfied if the update bit is clear. if the corresponding update bit is set, the transfer will occur immediately after the interlock mechanism is satisfied. example 2: a write to pwmb-d ($12) will not invoke the data - control interlock. however, if ra=rb, the write to either pwmb data register, will require a read/write to either pwma data register to satisfy the channel a - channel b interlock. note that if a read/write was made to the pwma interlock data register, the channel a - channel b interlock would still be satisfied but the data - control interlock will now be invoked for channel a. a write to ctl-a control register is now necessary to satisfy the channel a data - control interlock. assuming updatea and updateb are clear in the update register, the new contents of all these registers will be transferred into their respective active registers at the end of the current pwm cycle during which all invoked interlock mechanisms become satisfied. 9.6 pwm during wait mode the pwm continues normal operation during wait mode. to decrease power consumption during wait, it is recommended that the pwm subsystem be put into preset state.
MC68HC705MC4 specification rev. 1.5 section 9: pulse width modulator motorola page 63 9.7 pwm during stop mode in stop mode the oscillator is stopped causing the pwm to cease function. any signal in process is suspended in whatever phase the signal happens to be in. in the eprom device, the stop instruction will be disabled. 9.8 application examples the following examples demonstrate pwm configuration options to drive dc brush and permanent magnet brushless motors. the schematic diagrams are simplified for clarity. 9.8.1 dc brush motor interface the basic interface for a single dc brush motor is shown below. figure 9-9: dc brush motor interface pwm channel a is configured such that the pwm signal may be directed to either pa1 (csa1=1) or pa3 (csa2=1). when not driving the pwm signal, these ports should drive a logic 0 (mea=0, pa1=0, ddra1=1, pa3=0, ddra3=1). pa5 is configured as an output table 9-2: dc brush motor truth table function pa1 pa3 pa5 pa7 forward 0 pwm 1 0 reverse pwm 0 0 1 stop 0011 a + - b+ 0v pa1 pa3 pa5 pa7 pwma level shifters - mask feature disabled - pa1, pa3 drive pwm or logic 0 - pa5 and pa7 output ports t pd6 input capture
MC68HC705MC4 specification rev. 1.5 motorola section 9: pulse width modulator page 64 port (mea=0, ddra5=1). pa7 is configured as an output port (ddra7=1). the software moderates the pwm output pulse width based on speed feedback data obtained from a tachometer or other such device. the tachometer would typically drive an input capture, providing data to the mcu from which velocity and acceleration information can be derived. the system could be modified to provide positional data for servo applications. the truth table shown in table 9-2: dc brush motor truth table defines the h-bridge drive requirements for the motor from which the software would select based upon other system inputs. the MC68HC705MC4 can be configured to drive two motors using both pwm channels. 9.8.2 dc brushless motor interface a typical interface for a single dc brushless motor is shown below although many other configurations are possible. the rotor sensor usually consists of a hall effect sensor, optical encoder, or back-emf detector. the coil current feedback is shown to be linear in this example, using the on-chip a/d to provide torque data to the mcu. other systems may only require a current limit, which could be achieved with an interrupt pin (which will offer some hysteresis) and an external amplifier. with some reorganization of the i/o, it is also possible to configure the device to drive two brushless motor simultaneously b+ 0v pa5 pa2 pa4 pa6 pa1 pa3 ad0 level shifters a rotor position sensor pb5 pb6 pb7 3-phase brushless dc motor a b c r sense current/torque feedback pwma
MC68HC705MC4 specification rev. 1.5 section 9: pulse width modulator motorola page 65 although this will double the load on the processor. depending upon the complexity of the control algorithms adopted, and considering that the commutation must be performed with software, care must be taken to maintain commutation delays to within acceptable limits. the commutation would follow the sequence shown in table 9-3: brushless dc motor commutation sequence . table 9-3: brushless dc motor commutation sequence motor phase 012345 phase a top phase a bottom pwm off pwm off off off off on off on off off phase b top phase b bottom off on off off pwm off pwm off off off off on phase c top phase c bottom off off off on off on off off pwm off pwm off
MC68HC705MC4 specification rev. 1.5 motorola section 9: pulse width modulator page 66 figure 9-10: pwm register structure write all writes write to the buffer registers transfer enables at end of pwmb period* all reads read from the effective registers transfer enables at end of pwma period* write $14 read $14 ctl-a(effective) ctl-a(buffer) write $15 read $15 ctl-b(effective) ctl-b(buffer) write $16 read $16 rate (effective) rate (buffer) $10 read $10 data-a(effective) data-a(buffer) write $12 read $12 data-b(effective) data-b(buffer) $11 $13 $11 $13 *subject to satisfying interlock conditions and the state of the corresponging update bit.
MC68HC705MC4 specification rev. 1.5 section 10: serial communications interface motorola page 67 section 10 serial communications interface 10.1 introduction the serial communications interface (sci) module allows high-speed asynchronous communication with peripheral devices and other mcus. 10.2 features features of the sci module include the following: ? standard mark/space non-return-to-zero format ? full duplex operation ? 32 programmable baud rates ? programmable 8-bit or 9-bit character length ? separately enabled transmitter and receiver ? two receiver wakeup methods: - idle line wakeup - address mark wakeup ? interrupt-driven operation capability with five interrupt flags: - transmitter data register empty - transmission complete - receiver data register full - receiver overrun - idle receiver input ? receiver framing error detection ? 1/16 bit-time noise detection
MC68HC705MC4 specification rev. 1.5 motorola section 10: serial communications interface page 68 10.3 sci data format the sci uses the standard non-return-to-zero mark/space data format illustrated in figure 10-1: sci data format . figure 10-1: sci data format 10.4 sci operation the sci allows full-duplex, asynchronous, rs232 or rs422 serial communication between the mcu and remote devices, including other mcus. the transmitter and receiver of the sci operate independently, although they use the same baud-rate generator. the following paragraphs describe the operation of the sci transmitter and receiver. 10.4.1 transmitter figure 10-2: sci transmitter shows the structure of the sci transmitter. 10.4.1.1 character length the transmitter can accommodate either 8-bit or 9-bit data. the state of the m bit in sci control register 1 (sccr1) determines character length. when transmitting 9-bit data, bit t8 in sccr1 is the ninth bit (bit 8). 10.4.1.2 character transmission during transmission, the transmit shift register shifts a character out to the pb4/tdo pin. the sci data register (scdr) is the write-only buffer between the internal data bus and the transmit shift register. 8-bit data format (bit m in sccr1 clear) 9-bit data format (bit m in sccr1 set) start bit bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 stop bit next start bit bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 start bit stop bit next start bit
MC68HC705MC4 specification rev. 1.5 section 10: serial communications interface motorola page 69 figure 10-2: sci transmitter writing a logic one to the te bit in sci control register 2 (sccr2), and then writing data to the scdr, begins the transmission. at the start of a transmission, transmitter control logic automatically loads the transmit shift register with a preamble of logic ones. after the preamble shifts out, the control logic transfers the scdr data into the shift register. a logic zero start bit automatically goes into the least significant bit position of the shift register, and a logic one stop bit goes into the most significant bit position. when the data in the scdr transfers to the transmit shift register, the transmit data register empty (tdre) flag in the sci status register (scsr) becomes set. the tdre flag indicates that the scdr can accept new data from the internal data bus. t8 scdr ($000e) 6 7 543210 baud rate register (baud) scp0 scr2 scr1 scr0 $000a r8 sci control register 1 (sccr1) m wake $000b tcie tie sci control register 2 (sccr2) rie ilie te re rwu sbk $000c scp1 tc tdre sci status register (scsr) rdrf idlr or nf $000d bit 6 bit 7 sci data register (scdr) bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 $000e fe 0 transmit shift register 7 6 5 4 3 2 1 0 8 h l transmitter control logic load from scdr shift enable preamble (all logic ones) break (all logic zeros) tdre tc m t8 te ddr1 pin buffer and control pd2/ miso internal data bus sbk tie tcie sci receive requests sci interrupt request 1x baud rate clock
MC68HC705MC4 specification rev. 1.5 motorola section 10: serial communications interface page 70 when the shift register is not transmitting a character, the pb4/tdo pin goes to the idle condition, logic one. if software clears the te bit during the idle condition, and while tdre is set, the transmitter relinquishes control of the pb4/tdo pin. 10.4.1.3 break characters writing a logic one to the sbk bit in sccr2 loads the shift register with a break character. a break character contains all logic zeros and has no start and stop bits. break character length depends on the m bit in sccr1. as long as sbk is at logic one, transmitter logic continuously loads break characters into the shift register. after software clears the sbk bit, the shift register finishes transmitting the last break character and then transmits at least one logic one. the automatic logic one at the end of a break character is to guarantee the recognition of the start bit of the next character. 10.4.1.4 idle characters an idle character contains all logic ones and has no start or stop bits. idle character length depends on the m bit in sccr1. the preamble is a synchronizing idle character that begins every transmission. clearing the te bit during a transmission relinquishes the pb4/tdo pin after the last character to be transmitted is shifted out. the last character may already be in the shift register, or waiting in the scdr, or a break character generated by writing to the sbk bit. toggling te from logic zero to logic one while the last character is in transmission generates an idle character (a preamble) that allows the receiver to maintain control of the pb4/tdo pin. 10.4.1.5 transmitter interrupts the following sources can generate sci transmitter interrupt requests: ? transmit data register empty (tdre) the tdre bit in the scsr indicates that the scdr has transferred a character to the transmit shift register. tdre is a source of sci interrupt requests. the transmission complete interrupt enable bit (tcie) in sccr2 is the local mask for tdre interrupts. ? transmission complete (tc) the tc bit in the scsr indicates that both the transmit shift register and the scdr are empty and that no break or idle character has been generated. tc is a source of sci interrupt requests. the transmission complete interrupt enable bit (tcie) in sccr2 is the local mask for tc interrupts. 10.4.2 receiver figure 10-3: sci receiver shows the structure of the sci receiver.
MC68HC705MC4 specification rev. 1.5 section 10: serial communications interface motorola page 71 figure 10-3: sci receiver 10.4.2.1 character length the receiver can accommodate either 8-bit or 9-bit data. the state of the m bit in sci control register 1 (sccr1) determines character length. when receiving 9-bit date, bit r8 in sccr1 is the ninth bit (bit 8). 10.4.2.2 character reception during reception, the receive shift register shifts characters in from the pb5/rdi pin. the sci data register (scdr) is the read-only buffer between the internal data bus and the receive shift register. t8 scdr ($000e) 6 7 543210 baud rate register (baud) scp0 scr2 scr1 scr0 $000a r8 sci control register 1 (sccr1) m wake $000b tcie tie sci control register 2 (sccr2) rie ilie te re rwu sbk $000c scp1 tc tdre sci status register (scsr) rdrf idlr or nf $000d bit 6 bit 7 sci data register (scdr) bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 $000e fe 0 receive shift register 7 6 5 4 3 2 1 0 8 rdrf idle r8 re ddr pin buffer and control internal data bus m rie ilie sci transmit requests sci interrupt request 16x baud rate clock data recovery wakeup logic full overrun idle msb stop start ? 16 fe rwu nf or rie
MC68HC705MC4 specification rev. 1.5 motorola section 10: serial communications interface page 72 after a complete character shifts into the receive shift register, the data portion of the character is transferred to the scdr, setting the receive data register full (rdrf) ?ag. the rdrf ?ag can be used to generate an interrupt. 10.4.2.3 receiver wakeup so that the mcu can ignore transmissions intended only for other receivers in multiple-receiver systems, the mcu can be put into a standby state. setting the receiver wakeup enable (rwu) bit in sci control register 2 (sccr2) puts the mcu into a standby state during which receiver interrupts are disabled. either of two conditions on the pb5/rdi pin can bring the mcu out of the standby state: ? idle input line condition if the pd5/rdi pin is at logic one long enough for 10 or 11 logic ones to shift into the receive shift register, receiver interrupts are again enabled. ? address mark if a logic one occurs in the most significant bit position of a received character, receiver interrupts are again enabled. the state of the wake bit in sccr1 determines which of the two conditions wakes up the mcu. 10.4.2.4 receiver noise immunity the data recovery logic samples each bit 16 times to identify and verify the start bit and to detect noise. any conflict between noise-detection samples sets the noise flag (nf) in the scsr. the nf bit is set at the same time that the rdrf bit is set. 10.4.2.5 framing errors if the data recovery logic does not detect a logic one where the stop bit should be in an incoming character, it sets the framing error (fe) bit in the scsr. the fe bit is set at the same time that the rdrf bit is set. 10.4.2.6 receiver interrupts the following sources can generate sci receiver interrupt requests: ? receive data register full (rdrf) the rdrf bit in the scsr indicates that the receive shift register has transferred a character to the scdr. ? receiver overrun (or) the or bit in the scsr indicates that the receive shift register shifted in a new character before the previous character was read from the scdr. ? idle input (idle) the idle bit in the scsr indicates that 10 or 11 consecutive logic ones shifted in from the pd5/rdi pin.
MC68HC705MC4 specification rev. 1.5 section 10: serial communications interface motorola page 73 10.5 sci i/o registers the following i/o registers control and monitor sci operation: ? sci data register (scdr) ? sci control register 1 (sccr1) ? sci control register 2 (sccr2) ? sci status register (scsr) 10.5.1 sci data register (scdr) the sci data register is the buffer for characters received and for characters transmitted. 10.5.2 sci control register 1 (sccr1) sci control register 1 has the following functions: ? stores ninth sci data bit received and ninth sci data bit transmitted ? controls sci character length ? controls sci wakeup method r8 bit 8 (received) when the sci is receiving 9-bit characters, r8 is the ninth bit of the received character. r8 receives the ninth bit at the same time that the scdr receives the other eight bits. reset has no effect on the r8 bit. t8 bit 8 (transmitted) when the sci is transmitting 9-bit characters, t8 is the ninth bit of the 76543210 scdr $000e read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: unaffected by reset figure 10-4: sci data register (scdr) 76543210 sccr1 $000b read r8 t8 m wake write reset: unaffected by reset figure 10-5: sci control register 1 (sccr1)
MC68HC705MC4 specification rev. 1.5 motorola section 10: serial communications interface page 74 transmitted character. t8 is loaded into the transmit shift register at the same time that scdr is loaded into the transmit shift register. reset has no effect on the t8 bit. m character length this read/write bit determines whether sci characters are 8 bits long or 9 bits long. the ninth bit can be used as an extra stop bit, as a receiver wakeup signal, or as a mark or space parity bit. reset has no effect on the m bit. 1 = 9-bit sci characters 0 = 8-bit sci characters wake wakeup bit this read/write bit determines which condition wakes up the sci: a logic one (address mark) in the most signi?cant bit position of a received character or an idle condition of the pd5/rdi pin. reset has no effect on the wake bit. 1 = address mark wakeup 0 = idle line wakeup 10.5.3 sci control register 2 (sccr2) sci control register 2 has the following functions: ? enables the sci receiver and sci receiver interrupts ? enables the sci transmitter and sci transmitter interrupts ? enables sci receiver idle interrupts ? enables sci transmission complete interrupts ? enables sci wakeup ? transmits sci break characters tie transmit interrupt enable this read/write bit enables sci interrupt requests when the tdre bit becomes set. reset clears the tie bit. 1 = tdre interrupt requests enabled 0 = tdre interrupt requests disabled tcie transmission complete interrupt enable 76543210 sccr2 $000c read tie tcie rie ilie te re twu sbk write reset: 00000000 figure 10-6: sci control register 2 (sccr2)
MC68HC705MC4 specification rev. 1.5 section 10: serial communications interface motorola page 75 this read/write bit enables sci interrupt requests when the tc bit becomes set. reset clears the tcie bit 1 = tc interrupt requests enabled 0 = tc interrupt requests disabled rie receive interrupt enable this read/write bit enables sci interrupt requests when the rdrf bit or the or bit becomes set. reset clears the rie bit. 1 = rdrf interrup requests enabled 0 = rdrf interrupt requests disabled ilie idle line interrupt enable this read/write bit enables sci interrpt requests when the idle bit becomes set. reset clears the ilie bit. 1 = idle interrupt requests enabled 0 = idle interrupt requests disabled te transmit enable setting this read/write bit begins the transmission by sending a preamble of 10 or 11 logic ones from the transmit shift register to the pb4/tdo pin. reset clears the te bit. 1 = transmission enabled 0 = transmission disabled re receive enable setting this read/write bit enables the receiver. clearing the re bit disables the receiver and receiver interrupts but does not affect the receiver interrupt ?ags. reset clears the re bit. 1 = receiver enabled 0 = receiver disabled rwu receiver wakeup enable this read/write bit puts the receiver in a standby state. typically, data transmitted to the receiver clears the rwu bit and returns the receiver to normal operation. the wake bit in sccr1 determines whether an idle input or an address mark brings the receiver out of the standby state. reset clears the rwu bit. 1 = standby state 0 = normal operation sbk send break setting this read/write bit continuously transmits break codes in the form of 10-bit or 11-bit groups of logic zeros. clearing the sbk bit stops the break codes and transmits a logic one as a start bit. reset clears the sbk bit. 1 = break codes being transmitted 0 = no break codes being transmitted
MC68HC705MC4 specification rev. 1.5 motorola section 10: serial communications interface page 76 10.5.4 sci status register (scsr) the sci status register contains flags to signal the following conditions: ? transfer of scdr data to transmit shift register complete ? transmission complete ? transfer of receive shift register data to scdr complete ? receiver input idle ? receiver overrun ? noisy data ? framing error tdre transmit data register empty this clearable, read-only bit is set when the data in the scdr transfers to the transmit shift register. tdre generates an interrupt request if the tie bit in sccr2 is also set. clear the tdre bit by reading the scsr with tdre set, and then writing to the scdr. reset sets the tdre bit. software must initialize the tdre bit to logic zero to avoid an instant interrupt request when turning on the transmitter. 1 = scdr data transferred to transmit shift register 0 = scdr data not transferred to transmit shift register tc transmission complete this clearable, read-only bit is set when the tdre bit is set, and no data, preamble, or break character is being transmitted. tc generates an interrupt request if the tcie bit in sccr2 is also set. clear the tc bit by reading the scsr with tc set, and then writing to the scdr. reset sets the tc bit. software must initialize the tc bit to logic zero to avoid an instant interrupt request when turning on the transmitter. 1 = no transmission in progress 0 = transmission in progress rdrf receive data register full this clearable, read-only bit is set when the data in the receive shift register transfers to the sci data register. rdrf generates an interrupt request if the 76543210 scsr $000d read: tdre tc rdrf idle or nf fe write: reset: 1100000 figure 10-7: sci status register (scsr)
MC68HC705MC4 specification rev. 1.5 section 10: serial communications interface motorola page 77 rie bit in sccr2 is also set. clear the rdrf bit by reading the scsr with rdrf set, and then reading the scdr. reset clears the rdrf bit. 1 = received data available in scdr 0 = received data not available in scdr idle receiver idle this clearable, read-only bit is set when 10 or 11 consecutive logic ones appear on the receiver input. idle generates an interrupt request if the ilie bit in sccr2 is also set. clear the idle bit by reading the scsr with idle set, and then reading the scdr. reset clears the idle bit. 1 = receiver input idle 0 = receiver input not idle or receiver overrun this clearable, read-only bit is set if the scdr is not read before the receive shift register receives the next word. or generates an interrupt request if the rie bit in sccr2 is also set. the data in the shift register is lost, but the data already in the scdr is not affected. clear the or bit by reading the scsr with or set, and then reading the scrd. reset clears the or bit. 1 = receiver shift register full and rdrf = 1 0 = no receiver overrun nf receiver noise flag this clearable, read-only bit is set when noise is detected in data received in the sci data register. clear the nf bit by reading the scsr, and then reading the scdr. reset clears the nf bit. 1 = noise detected in scdr 0 = no noise detected in scdr fe receiver framing error this clearable, read-only ?ag is set when there is a logic zero where a stop bit should be in the character shifted into the receive shift register. if the received word causes both a framing error and an overrun error, the or bit is set and the fe bit is not set. clear the fe bit by reading the scsr, and then reading the scdr. reset clears the fe bit. 1 = framing error 0 = no framing error
MC68HC705MC4 specification rev. 1.5 motorola section 10: serial communications interface page 78 10.5.5 baud rate register (baud) the baud rate register selectes the baud rate for both the receiver and the transmitter. scp1 and scp0 sci prescaler select bits these read/write bits control prescaling of the baud rate generator clock, as shown in table 10-1:. resets clear both scp1 and scp0. scr2Cscr0 sci baud rate select bits these read/write bits select the sci baud rate, as shown in table 10-2: baud rate selection . reset has no effect on the scr2Cscr0 bits. 76543210 spdr $000a read: scp1 5 scp0 scr2 scr1 scr0 write: reset: 0 0 u u u u = unaffected figure 10-8: baud rate register (baud) table 10-1: baud rate generator clock prescaling scp[0:1] baud rate generator clock 00 internal clock ? 1 01 internal clock ? 3 10 internal clock ? 4 11 internal clock ? 13
MC68HC705MC4 specification rev. 1.5 section 10: serial communication interface motorola page 79 table 10-3: baud rate selection examples shows all possible sci baud rates derived from crystal frequencies of 2 mhz, 4 mhz, 4.194304 mhz, and 6 mhz. table 10-2: baud rate selection scr[2:1:0] sci baud rate (baud) 000 prescaled clock ? 1 001 prescaled clock ? 2 010 prescaled clock ? 4 011 prescaled clock ? 8 100 prescaled clock ? 16 101 prescaled clock ? 32 110 prescaled clock ? 64 111 prescaled clock ? 128
MC68HC705MC4 specification rev. 1.5 motorola section 10: serial communication interface page 80 table 10-3: baud rate selection examples scp[1:0] scr[2:1:0] sci baud rate f osc = 4 mhz f op = 2 mhz f osc = 4.194304 mhz f op = 2.097152 mhz f osc = 6 mhz f op = 3 mhz 00 000 125 kbaud 131.1 kbaud 187.5 kbaud 00 001 62.50 kbaud 65.54 kbaud 93.75 kbaud 00 010 31.25 kbaud 32.77 kbaud 46.89 kbaud 00 011 15.63 kbaud 16.38 kbaud 23.44 kbaud 00 100 7813 baud 8192 baud 11.72 kbaud 00 101 3906 baud 4096 baud 5859 baud 00 110 1953 baud 2048 baud 2930 baud 00 111 976.6 baud 1024 baud 1465 baud 01 000 41.67 kbaud 43.69 kbaud 62.49 kbaud 01 001 20.83 kbaud 21.85 kbaud 31.26 kbaud 01 010 10.42 kbaud 10.92 kbaud 15.62 kbaud 01 011 5208 baud 5461 baud 7812 baud 01 100 2604 baud 2731 baud 3906 baud 01 101 1302 baud 1365 baud 1953 baud 01 110 651.0 baud 682.7 baud 976.5 baud 01 111 325.5 baud 341.3 baud 488.4 baud 10 000 31.25 kbaud 32.77 kbaud 46.89 kbaud 10 001 15.63 kbaud 16.38 kbaud 23.44 kbaud 10 010 7813 baud 8192 baud 11.72 kbaud 10 011 3906 baud 4906 baud 5859 baud 10 100 1953 baud 2048 baud 2930 baud 10 101 976.6 baud 1024 baud 1465 baud 10 110 488.3 baud 512.0 baud 732.3 baud 10 111 244.1 baud 256.0 baud 366.3 baud 11 000 9615 baud 10.08 kbaud 14.42 kbaud 11 001 4808 baud 5041 baud 7212 baud 11 010 2404 baud 2521 baud 3606 baud 11 011 1202 baud 1260 baud 1803 baud 11 100 601.0 baud 630.2 baud 901.5 baud 11 101 300.5 baud 315.1 baud 450.6 baud 11 110 150.2 baud 157.5 baud 225.4 baud 11 111 75.12 baud 78.77 baud 112.7 baud
MC68HC705MC4 specification rev. 1.5 section 11: core timer motorola page 81 section 11 core timer the core timer (ctimer) for this device is a 15-stage multi-functional ripple counter. the features include timer overflow, power-on reset (por), real time interrupt, and cop watchdog timer figure 11-1: core timer block diagram cop clear internal bus 7-bit counter interrupt circuit $08 ctcsr rti select circuit overflow circuit detect cop watchdog timer ( ? 8) to reset logic to interrupt logic 8 8 f op f op /2 2 f op /2 10 por tcbp ctcsr ctcr internal processor clock ctof rtif ctoie rtie rt1 rt0 ctimer control & status register $09 core timer counter register (ctcr) ? 4
MC68HC705MC4 specification rev. 1.5 motorola section 11: core timer page 82 as seen in figure 11-1: core timer block diagram , the core timer is driven by the internal bus clock divided by four as a fixed prescaler. this signal drives an 8-bit ripple counter. the value of this 8-bit ripple counter can be read by the cpu at any time by accessing the ctimer counter register (ctcr) at address $09. a timer overflow function is implemented on the last stage of this counter, giving a possible interrupt at the rate of e/1024. two additional stages produce the por function at e/4064. the timer counter bypass circuitry (available only in test mode) is at this point in the timer chain. this circuit is followed by one more stage, with the resulting clock (e/8192) driving the real time interrupt circuit. the rti circuit consists of four divider stages with a 1 of 4 selector. the output of the rti circuit is further divided by eight to drive the mask optional cop watchdog timer circuit. the rti rate selector bits, and the rti and ctof enable bits and flags are located in the ctimer control and status register(ctcsr) at location $08. 11.1 ctimer control and status register (ctcsr) $08 the ctcsr contains the timer interrupt flag, the timer interrupt enable bits, and the real time interrupt rate select bits. figure 11-2: core timer control and status register (ctcsr) shows the value of each bit in the ctcsr when coming out of reset. figure 11-2: core timer control and status register (ctcsr) 11.1.1 ctof - core timer overflow flag ctof is a clearable, read-only status bit and is set when the 8-bit ripple counter rolls over from $ff to $00. a cpu interrupt request will be generated if ctoie is set. clearing the ctof is done by writing a 0 to it. writing a 1 to ctof has no effect on the bits value. reset clears ctof. 11.1.2 rtif - real time interrupt flag the real time interrupt circuit consists of a four stage divider and a 1 of 4 selector. the clock frequency that drives the rti circuit is e/2 13 (or e/8192) with four additional divider stages giving a maximum interrupt period of 4 seconds at a crystal frequency of 32.768 khz. rtif is a clearable, read-only status bit and is set when the output of the chosen (1 of 4 selection) stage goes active. a cpu interrupt request will be generated if rtie is set. clearing the rtif is done by writing a 0 to it. writing a 1 to rtif has no effect on this bit. reset clears rtif. 11.1.3 ctoie - core timer overflow interrupt enable when this bit is set, a cpu interrupt request is generated when the ctof bit is set. reset clears this bit. 11.1.4 rtie - real time interrupt enable when this bit is set, a cpu interrupt request is generated when the rtif bit is set. reset clears this bit. ctof ctoie rtie -- -- rt1 rt0 rtif $08 0 000011 0 reset:
MC68HC705MC4 specification rev. 1.5 section 11: core timer motorola page 83 11.1.5 rt1:rt0 - real time interrupt rate select these two bits select one of four taps from the real time interrupt circuit. table 11-1: rti rates shows the available interrupt rates with several f op values. reset sets these rt0 and rt1, selecting the lowest periodic rate and therefore the maximum time in which to alter these bits if necessary. care should be taken when altering rt0 and rt1 if the time-out period is imminent or uncertain. if the selected tap is modified during a cycle in which the counter is switching, an rtif could be missed or an additional one could be generated. to avoid problems, the cop should be cleared before changing rti taps. table 11-1: rti rates 11.2 computer operating properly (cop) watchdog reset the cop watchdog timer function is implemented on this device by using the output of the rti circuit and further dividing it by eight. the minimum cop reset rates are listed in 11.3: ctimer counter register (ctcr) $09 . if the cop circuit times out, an internal reset is generated and the normal reset vector is fetched. preventing a cop time-out is done by writing a 0 to bit 0 of address $0ff0. when the cop is cleared, only the final divide by eight stage (output of the rti) is cleared. this function is a mask option. table 11-2: minimum cop reset times 11.3 ctimer counter register (ctcr) $09 the core timer counter register is a read-only register that contains the current value of the 8-bit ripple counter at the beginning of the timer chain. this counter is clocked at f op rt1:rt0 3.0 mhz 00 10.9 ms 01 21.8 ms 10 43.75 ms 11 5.5 ms 16.384 khz 2 s 4 s 8s 1 s div. ratio 2 15 2 16 2 17 2 14 rti rates at bus frequency of: rt1:rt0 3.0 mhz 00 76.5 ms 01 153.0 ms 10 305.9 ms 11 38.2 ms 16.384 khz 14 s 28 s 56 s 7 s f op 7 (rti rate) 7 (rti rate) 7 (rti rate) 7 (rti rate) minimum cop reset at bus frequency:
MC68HC705MC4 specification rev. 1.5 motorola section 11: core timer page 84 divided by 4 and can be used for various functions including a software input capture. extended time periods can be attained using the ctof function to increment a temporary ram storage location thereby simulating a 16-bit (or more) counter. figure 11-3: core timer counter register the power-on cycle clears the entire counter chain and begins clocking the counter. after 4064 cycles, the power-on reset circuit is released that again clears the counter chain and allows the device to come out of reset. at this point, if reset is not asserted, the timer will start counting up from zero and normal device operation will begin. when reset is asserted anytime during operation (other than por), the counter chain will be cleared. 11.4 core timer during wait mode the cpu clock halts during the wait mode, but the timer remains active. if the interrupts are enabled, the timer interrupt will cause the processor to exit the wait mode. 11.5 core timer during stop mode the core timer is cleared when going into stop mode. when stop is exited by an external interrupt or an external reset, the internal oscillator will resume, followed by 4064 cycles internal processor stabilization delay. the timer is then cleared and operation resumes. ctcr7 ctcr5 ctcr4 ctcr3 ctcr2 ctcr1 ctcr0 ctcr6 $09
MC68HC705MC4 specification rev. 1.5 section 12: electrical specifications motorola page 85 section 12 electrical specifications 12.1 maximum ratings (voltages referenced to v ss ) this device contains circuitry to protect the inputs against damage due to high static voltages or electric fields; however, it is advised that normal precautions be taken to avoid application of any voltage higher than maximum-rated voltages to this high-impedance circuit. for proper operation, it is recommended that v in and v out be constrained to the range v ss (v in or v out ) v dd . reliability of operation is enhanced if unused inputs are connected to an appropriate logic voltage level (i.e., either v ss or v dd ). 12.2 thermal characteristics storage temperature range t stg -65 to +150 c MC68HC705MC4 (automotive) 2 v dd + 0.3 supply voltage unit value symbol rating v -0.3 to + 7.0 v dd input voltage v ss - 0.3 to v in v self-check mode ( irq pin only) v ss - 0.3 to v v in current drain per pin excluding v dd and v ss 25 ma i operating temperature range t l to t h c t a 0 to +70 MC68HC705MC4 (standard) v dd + 0.3 MC68HC705MC4 (extended) -40 to +85 -40 to +105 60 60 thermal resistance plastic c/w q ja unit value symbol characteristic soic
MC68HC705MC4 specification rev. 1.5 motorola section 12: electrical specifications page 86 12.3 dc electrical characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = -40 c to +tbd c, unless otherwise noted) notes: 1. all values shown reflect average measurements. 2. typical values at midpoint of voltage range, 25 c only. 3. wait i dd : only timer system active. 4. run (operating) i dd , wait i dd : measured using external square wave clock source (f osc = 4.2 mhz), all inputs 0.2 v from rail; no dc loads, less than 50pf on all outputs, c l = 20 pf on osc2. 5. wait, stop i dd : all ports configured as inputs, v il = 0.2 v, v ih = v dd -0.2 v. 6. stop i dd measured with osc1 = v ss . 7. wait i dd is affected linearly by the osc2 capacitance. 8. pre-silicon estimate. i dd i dd i dd output voltage i load = 10.0 m a unit max typ min symbol characteristic v 0.1 v ol v dd - 0.1 v oh output high voltage v dd - 0.8 v oh (i load = -0.8 ma) pb4-7,pc0-7, pd6/tcmp, osc2 v output low voltage 0.4 v ol (i load = 1.6 ma) pa0-7, pb4-6, pc0-7, pd6, tcmp, osc2 v input high voltage v dd v ih pa0-7, pb4-7, pc0-7, pd6, tcap/pd7, irq, reset, osc1 v 0.7 v dd supply current (see notes) ma run ma wait stop 25 c m a 0 c to +70 c (standard) i/o ports hi-z leakage current 10 i il pa0-7, pb4-7, pc0-7, pd6, tcap/pd7 m a input current 1 i in reset, irq, osc1 m a capacitance 12 c out ports (as input or output) pf reset, irq c in 8 pf input low voltage 0.2 v dd v il pa0-7, pb4-7, pc0-7, pd6, tcap/ pd7, irq, reset, osc1 v v ss a/d ports hi-z leakage current 1 i il pc0-5 m a -40 c to +85 c (extended) -40 c to +125 c (automotive) i dd i dd i dd tbd tbd tbd tbd tbd 5 (note 8) tbd tbd tbd tbd tbd tbd m a m a m a 1.0 v ol (i load = 10.0 ma) pb7 v v dd -2.0 v oh (i load = -10.0 ma) pa0-7 (max total i load = 20ma) v input injection current 100 i inj pa7 m a
MC68HC705MC4 specification rev. 1.5 section 12: electrical specifications motorola page 87 12.4 a/d converter characteristics (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = -40 c to +tbd c, unless otherwise noted) *t ad = t cyc if clock source equals mcu. 1 1/2 comments unit max min characteristic bits 8 8 resolution absolute accuracy lsb (v dd 3 v refh > 4.0) conversion range v v ss v refh a/d accuracy may decrease proportionately as v refh is reduced below 4.0 v dd v v ss v refh input leakage m a ad0, ad1, ad2, ad3, ad4, ad5 1 v refh 1 m a conversion time t ad * 32 32 (includes sampling time) inherent (within total error) monotonicity hex 01 00 zero input reading v in = 0v hex ff fe full-scale reading v in = v refh t ad * 12 12 sample time pf 12 input capacitance v v refh v ss analog input voltage including quantization
MC68HC705MC4 specification rev. 1.5 motorola section 12: electrical specifications page 88 12.5 control timing (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = -40 c to +tbd c, unless otherwise noted) * the minimum period t ilil should not be less than the number of cycles it takes to execute the interrupt service routine plus 19 t cyc . unit max min symbol characteristic frequency of operation 6 f osc crystal option mhz 6 dc f osc external clock option mhz internal operating frequency 3 f op crystal (f osc ? 2) mhz 3 dc f op external clock (f osc ? 2) mhz cycle time 333 t cyc ns crystal oscillator start-up time 100 t oxov ms stop recovery start-up time (crystal oscillator) 100 t ilch ms reset pulse width 1.5 t rl t cyc interrupt pulse width low (edge-triggered) tbd t ilih ns interrupt pulse period * t ilil t cyc 200 t oh , t ol ns osc1 pulse width 100 t adon m s a/d on current stabilization time 5.0 t rcon m s rc oscillator stabilization time (a/d)
MC68HC705MC4 specification rev. 1.5 section 12: electrical specifications motorola page 89 control timing (continued) figure 12-1: power-on reset and external reset timing diagram pch pcl osc1 2 reset internal processor internal address bus 1 0ffe 0fff v dd v dd threshold (1-2 v typical) t vddr 4064 t cyc t cyc t rl internal data bus 1 0ffe 0ffe 0ffe 0ffe new pc 0fff notes: 1. internal timing signal and bus information not available externally. 2. osc1 line is not meant to represent frequency. it is only used to represent time. 3. the next rising edge of the internal clock following the rising edge of reset initiates the reset sequence. note 3 new new op code pcl pch new pc new pc op code new pc clock 1
motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and speci?cally disclaims any and all liability, including without limitation consequential or incidental damages. "typical" parameters can and do vary in different applications. all operating parameters, including "typicals" must be validated for each customer application by customer's technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its of?cers, employees, subsidiaries, af?liates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and are registered trademarks of motorola, inc. motorola, inc. is an equal opportunity/af?rmative action employer. how to reach us: mfax: rmfax0@email.sps.mot.com - touchtone (602) 244-6609 internet: http://design-net.com usa/europe: motorola literature distribution; p.o. box 20912; phoenix, arizona 85036. 1-800-441-2447 japan: nippon motorola ltd.; tatsumi-spd-jldc, toshikatsu otsuki, 6f seibu-butsuryu-center, 3-14-3 tatsumi koto-ku, tokyo 135, japan. 03-3521-8315 hong kong: motorola semiconductors h.k. ltd.; 8b tai ping industrial park, 51 ting tok road, tai po, n.t., hong kong. 852-26629298


▲Up To Search▲   

 
Price & Availability of MC68HC705MC4

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X